怎樣用CSS只對錶格table的標籤設定邊框

來源:互聯網
上載者:User
很多朋友都很苦惱表格樣式怎麼設定,今天就給大家詳細講解一下css表格樣式怎麼設定。先說一種方法,只對table設定邊框。之後給大家帶來設定表格其他元素的方法,請持續關注

只對table標籤設定border(邊框)樣式,將讓此表格最外層table一個邊框,而表格內部不產生邊框樣式。

案例詳細如下:

1、對應css代碼

<style> .table-a table{border:1px solid #F00} /* css注釋:只對table標籤設定紅色邊框樣式 */ </style>

2、對應html程式碼片段

1、對應css代碼

<style> .table-a table{border:1px solid #F00} /* css注釋:只對table標籤設定紅色邊框樣式 */ </style>

2、對應html程式碼片段

<div class="table-a"> <table width="400" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="105">站名</td> <td width="181">網址</td> <td width="112">說明</td> </tr> <tr> <td>PHP</td> <td>www.php.cn</td> <td>CSS學習</td> </tr> <tr> <td>CSS5</td> <td>www.php.cn</td> <td>CSS切圖</td> </tr> </table> </div>

這就是CSS只對錶格table的標籤設定邊框的方法,你學到了嗎?

相關閱讀:

用DIV和CSS作下拉式功能表

css3實現陰影製作效果執行個體

css布局需要注意的幾點

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.