开发者

How to add a line in a table?

开发者 https://www.devze.com 2023-03-31 22:58 出处:网络
I have a table like this: <table> <tr> <th>Firstname</th> <th>Lastname</th>

I have a table like this:

<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</t开发者_开发技巧r>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
<tr>
<td>Lois</td>
<td>Griffin</td>
</tr>

But between the row of Peter Griffin, and Lois Griffin, I want make a line to separate them like this:

_____________________
[Firstname][Lastname]
---------------------
[   Peter ][Griffin]
--------------------- <---add a line here
[   Lois  ][Griffin]
---------------------


Should use CSS, something like this should work:

td { border-bottom: solid 1px #CCCCCC; }

Add padding if you want to space the words from the line a bit:

td { padding-top:5px; padding-bottom:5px; }


use css

table tr th, table tr td
{
border-bottom-width: 1px;
border-bottom-style: dotted;
border-bottom-color: #666;
}


tr{ border-bottom: solid 1px #999; float: left; width: 100% }

then for cols (lets say u have 3 cols)

td{width: 30%; float: left; text-indent: 10px; border-right: solid 1px #999; overflow: hidden; padding: 1%;}

The reason for over flow is to hide text that are longer that the field

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号