表格邊框默認(rèn)是以實(shí)線進(jìn)行顯示的,怎么才能把它變成虛線呢?其實(shí)很簡單只要簡單加一些樣式屬性便可搞定,希望下面的例子對(duì)大家有所幫助

創(chuàng)新互聯(lián)建站是一家專業(yè)提供六合企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、H5響應(yīng)式網(wǎng)站、小程序制作等業(yè)務(wù)。10年已為六合眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。
復(fù)制代碼
代碼如下:
style
.table5{text-align:center;
border:1px
solid
#cccccc;
border-radius
:3px;
background-color:#FFFFFF;
width:650px;}
.table5
td{border-bottom:1px
dashed
#cccccc;}
.table5
.last
td{border-bottom:0;}
/style
復(fù)制代碼
代碼如下:
table
width="100%"
border="0"
cellpadding="2"
cellspacing="0"
class="table5"
tr
td
colspan="4" /td
/tr
tr
td
width="4%"img
src="images/greendot.jpg"
width="4"
height="4"
//td
td
width="17%"
class="text-fl"萍水相逢/td
td
width="63%"
align="center"
class="text-fl"消費(fèi)10個(gè)金幣,對(duì)換10元手機(jī)費(fèi)/td
td
width="16%"
align="center"
valign="middle"2013.01.20/td
/tr
tr
class="last"
td
img
src="images/greendot.jpg"
//td
td
class="text-fl"M萍水相MM/td
td
align="center"
class="text-fl"消費(fèi)500積分,對(duì)換500粉絲/td
td
align="center"
valign="middle"2013.01.20/td
/tr
tr
td
colspan="4"/td
/tr
/table
已知的方式有2種(純樣式):
1.用標(biāo)簽(div、span這些標(biāo)簽都可以)的邊框線設(shè)置虛線來實(shí)現(xiàn),比如在需要的位置插入div然后設(shè)置border-top(或者border-bottom):1px dashed #e5e5e5;(3個(gè)屬性分別表示:1像素的邊寬 虛線 顏色);
2.用hr,不過因?yàn)閷?shí)現(xiàn)方式和方式一一樣,比如:hr style="height:1px;border:none;border-top:1px dashed #e5e5e5;" /,但是這個(gè)標(biāo)簽在H5種已經(jīng)被淘汰了,完全可以靠第一種來實(shí)現(xiàn)。第二種就當(dāng)做是知識(shí)擴(kuò)展
css有兩種虛線形式,一種是dashed,一種是dotted;如:
div?style="width:100px;height:100px;border:1px?dashed?red"/div
div?style="width:100px;height:100px;border:1px?dotted?red"/div
效果圖如下:
在CSS 中常見的邊框(border) 屬性有以下幾種:
border-style
border-width
border-color
border-top-, border-left-, border-bottom-, border-right-
border
border-style
border-style屬性指定邊框的樣式。以下的表格列出這個(gè)屬性可能有的值,以及每一個(gè)值顯現(xiàn)出來的結(jié)果。
border-width
border-width屬性是用來設(shè)定邊框的寬度。可用的值為thin (薄)、medium (中等)、thick (厚),或是一個(gè)數(shù)字。
border-color
border-color屬性是用來設(shè)定邊寬的顏色。
border-top-, border-left-, border-bottom-, border-right-
我們可以將方向(top -上、bottom -下、left -左、right -右)和樣式、寬度、及顏色合起來而成為一個(gè)屬性。舉例來說, border-top-style屬性就是用來設(shè)定上邊框的樣式。以下舉幾個(gè)例子:
border
若四邊的邊框?qū)傩远家粯樱俏覀兛梢杂靡粋€(gè)border屬性來描述,而不必四個(gè)邊都描述一次。另外,我們可以在同一行一次宣告邊框樣式、邊框?qū)挾取⒁约斑吙蝾伾?/p>
p {
border:#0000FF 5px solid;?
}
那以下的HTML,
p用一行來宣布所有邊框的屬性/p ?
會(huì)顯現(xiàn)出
在css里可以設(shè)置邊框,你可以只要上邊框或者下邊框,你可以設(shè)置只要上下不要左右,這樣就不會(huì)有重疊了!
style type="text/css"
!--
.dashed_tbl {
border-top: 1px dashed #333333;
border-left: 1px dashed #333333;
}
.dashed_tbl td{
border-bottom:1px dashed #333333;
border-right:1px dashed #333333;
padding:3px 10px;
}
--
/style
table cellpadding="0" cellspacing="0" class="dashed_tbl"
tr
td123/td
td234/td
td345/td
/tr
tr
td123/td
td234/td
td345/td
/tr
tr
td123/td
td234/td
td345/td
/tr
/table
是不是這樣的?
網(wǎng)頁名稱:css表格虛線樣式,css樣式邊框虛線
本文鏈接:http://chinadenli.net/article17/dsisogj.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、微信小程序、網(wǎng)站改版、App開發(fā)、App設(shè)計(jì)、域名注冊(cè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)