指定的table為細邊框,把table放在div中即可。

站在用戶的角度思考問題,與客戶深入溝通,找到西烏珠穆沁網站設計與西烏珠穆沁網站推廣的解決方案,憑借多年的經驗,讓設計與互聯網技術結合,創造個性化、用戶體驗好的作品,建站類型包括:成都網站建設、網站設計、企業官網、英文網站、手機端網站、網站推廣、空間域名、網站空間、企業郵箱。業務覆蓋西烏珠穆沁地區。
一、首先新建表格,代碼如下:
table width="500" border="1"? trtdnbsp;/tdtdnbsp;/tdtdnbsp;/td/tr trtdnbsp;/tdtdnbsp;/tdtdnbsp;/td /trtr? tdnbsp;/td tdnbsp;/tdtdnbsp;/td/tr/table。
二、在table里加css樣式,代碼如下:
table width="500" border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse;"? tr tdnbsp;/tdtdnbsp;/td tdnbsp;/td /tr tr tdnbsp;/tdtdnbsp;/tdtdnbsp;/td/tr trtdnbsp;/tdtdnbsp;/tdtdnbsp;/td/table。
三、單元格邊距(表格填充)(cellpadding) -- 代表單元格外面的一個距離,用于隔開單元格與單元格空間。單元格間距(表格間距)(cellspacing) -- 代表表格邊框與單元格補白的距離,也是單元格補白之間的距離,border-collapse:collapse表示表格的兩邊框合并為一條即可。
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""
html xmlns=""
head
meta http-equiv="Content-Type" content="text/html; charset=utf-8" /
title千聲盒子/title
style type="text/css"
/*不要使用標簽名作為類名*/
/*.table{text-align:center;width:100%;height:100%;border-width:thin;border-style:solid;border-color:#AA9FFF;border-collapse:separate;}*/
.tbClass {
text-align:center;
width:100%;height:100%;
/*首先對大表格加上左邊 和 底邊*/
/*我自作主張加上了底邊框,可以刪掉去*/
/*聽說FF下不支持縮寫,請你自己把下面的寫法拆分出來*/
border-left:2px #AA9FFF solid; /* 左邊框 */
border-bottom:2px #AA9FFF solid; /*底邊框*/
}
.tbClass td {/*單元格的上邊和右邊*/
border-top:2px #AA9FFF solid;
border-right:2px #AA9FFF solid;
}
.tbClass td {/*測試用,為了看到效果,你可以把這個刪掉去*/
/*width:100px; height:80px;*/
}
/*專門為“盒子那行寫的類”*/
.boxCell td { height:101px; padding:0; margin:0}
/style
/head
body
table id="Box" name="Box" class="tbClass" cellspacing=0!--注意! 1:我把類名由table改成tbClass了, 2: cellspacing=0--
?php
for($i=1;$i=1000;$i++){
if($i%5==0){
echo "td$i/td";
echo "/tr
tr class=\"boxCell\"
td盒子/td
td盒子/td
td盒子/td
td盒子/td
td盒子/td
/tr
";/////注意! 這里使用了一個boxCell的CSS類,不會那么多冗余代碼
echo "tr";
}else{
echo "td$i/td";
}
}
?
/table
/body
/html
//////最后說明;
1。如果亂碼,或無顯示,請注意你php文件的編碼格式,或在瀏覽器下選擇GBK32編碼
2。這種專業問題,如果到Csdn 里發帖,十分鐘之內就有人回答了
3。百度的BUG:回復后再修改,就不能保持代碼的縮進了 -_-!即不能tab縮進,要換成4個空格
以下是定義行高代碼,數字越大,行與行之間距離越大
.td{
line-height: 12px;
}
或者用百分比也行
.td{
line-height: 150%;
}
調用時先在head/head之間放入
link href="css.css" rel="stylesheet" type="text/css" /
注意href="css.css"是路徑自己定義
調用時用class="td"就行了
例:
table width="50"
tr
td class="td"121312313131/td
/tr
/table
下面來個例子,你可以復制到你的編輯器里修改測試
style type="text/css"
table.gridtable {}{
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
}
table.gridtable th {}{
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}
table.gridtable td {}{
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
/style
!-- Table goes in the document BODY --
table class="gridtable"
tr
thInfo Header 1/ththInfo Header 2/ththInfo Header 3/th
/tr
tr
tdText 1A/tdtdText 1B/tdtdText 1C/td
/tr
tr
tdText 2A/tdtdText 2B/tdtdText 2C/td
/tr
/table
CSS(層疊樣式表)級聯樣式表是一種用來表現HTML(標準通用標記語言的一個應用)或XML(標準通用標記語言的一個子集)等文件樣式的計算機語言。
xhtml如下:
div id="byitem"
h3 class="tabletitle"Widgets America (source by item)/h3
ul class="vert"
li class="tableheader"
ul class="horz"
liItem #/li
li class="name"Name/li
liColor/li
liIn Stock?/li
li class="price"Price/li
/ul
/li
li
ul class="horz"
li8476292163/li
li class="name"Cheese Widget/li
liGreen/li
liYes/li
li class="price"$3.14/li
/ul
/li
/ul
/div
CSS如下:
/* Widgets America (by item)
------------------------------------*/
div#byitem ul.vert {
list-style-type: none;
padding: 0;
margin: 0;
width: 540px;
}
div#byitem ul.vert li {
padding: 4px 0;
margin: 0;
height: 14px; /* space out your rows */
}
div#byitem ul.vert li.odd {
background-color: #eee;
}
div#byitem ul.horz {
clear: left;
list-style-type: none;
padding: 0;
margin: 0;
}
div#byitem ul.horz li {
float: left;
width: 80px;
padding: 0 20px 0 0;
margin: 0;
}
div#byitem ul.horz li.name { /* size your columns individually at the expense of ?
slightly bloated markup (labelling each appropriate li with this class) */
width: 130px;
}
div#byitem ul.horz li.price {
text-align: right;
padding-right: 0;
}
分享文章:表格樣式模板css,表格模板大全 簡單
文章起源:http://www.yijiale78.com/article16/dsihpgg.html
成都網站建設公司_創新互聯,為您提供ChatGPT、營銷型網站建設、外貿網站建設、外貿建站、網站營銷、網站內鏈
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯