2013-10-22 66 views
0

我有一个在html中有一些行和列的表格,我只想使表格的顶部和底部边框可见。任何人都可以提供建议吗?使用CSS制作表格的顶部和底部边框可以使用css

这是我目前的代码。

table#beta 
     { 
      border-collapse:collapse; 
     } 
     table#beta td 
     { 
      border:1px solid black; 
     } 

<table id ="beta" border="0" width="100%"> 
+2

把你的相关代码/结构不是犯罪这里 –

回答

2

下面代码片段

<table> 
    <tr><td>hello</td><td>test</td></tr> 
    <tr><td>hello</td><td>test</td></tr> 
    <tr><td>hello</td><td>test</td></tr> 
    <tr><td>hello</td><td>test</td></tr> 
</table> 

和风格

table { 
    border: none; 
    border-top: 1px solid Black; 
    border-bottom: 1px solid Black; 
} 

jsFiddle here

1

入住此...

<style type="text/css"> 
.my_table { 
    border-top:1px solid ; 
    border-bottom:1px solid ; 
} 
</style> 
<table class="my_table" cellpadding="0" cellspacing="0"> 
    <tr> 
     <td>Column1</td> 
     <td>Column2</td> 
     <td>Column3</td> 
     <td>Column4</td> 
    </tr> 
    <tr> 
     <td>AAAAA</td> 
     <td>AAAAA</td> 
     <td>AAAAA</td> 
     <td>AAAAA</td> 
    </tr> 
    <tr> 
     <td>BBBBB</td> 
     <td>BBBBB</td> 
     <td>BBBBB</td> 
     <td>BBBBB</td> 
    </tr> 
</table> 
1

使用这样的:

table{ 
border-top: 1px solid #000; 
border-bottom: 1px solid #000; 
} 

demo