當(dāng)前位置:軟件學(xué)堂 > 資訊首頁(yè) > 網(wǎng)絡(luò)編程 > DIV+CSS > css border-collapse屬性(表格邊框合并)

css border-collapse屬性(表格邊框合并)

2012/11/25 22:00:12作者:佚名來(lái)源:網(wǎng)絡(luò)

移動(dòng)端

【實(shí)例介紹】

css border-collapse屬性(表格邊框合并)

border-collapse屬性設(shè)置表格的邊框是被合并為一個(gè)單一的邊框,還是分別有各自的邊框。

【基本語(yǔ)法】

border-collapse :separate|collapse

【語(yǔ)法介紹】

separate:默認(rèn)值。邊框分開(kāi),不合并。
collapse:邊框合并。即如果相鄰,則共用同一個(gè)邊框。

【實(shí)例代碼】

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>無(wú)標(biāo)題文檔</title> </head> </head> <body> <table width="300" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000">   <tr>     <td>&nbsp;</td>     <td>&nbsp;</td>   </tr>   <tr>     <td>&nbsp;</td>     <td>&nbsp;</td>   </tr> </table> <p>&nbsp;</p> <table width="300" border="1" cellpadding="0" cellspacing="0" bordercolor="#FF0000" style="border-collapse:collapse;">    <tr>      <td>&nbsp;</td>      <td>&nbsp;</td>   </tr>    <tr>       <td width="150" >&nbsp;</td>      <td width="150" >&nbsp;</td>   </tr> </table> </body> </html>

 

【代碼分析】

在代碼中,加粗部分是應(yīng)用邊框合并屬性,如圖1 5.1下面的表格所示,上面的表格是沒(méi)有
應(yīng)用合并屬性的效果。

邊框合并屬性border-collapse


 【素材及源碼下載】

請(qǐng)點(diǎn)擊:border-collapse屬性(表格邊框合并) 下載本實(shí)例相關(guān)素材及源碼

 

標(biāo)簽: 表格  邊框合并  屬性