CSS and tables: Displaying lines between columns, but not between rows
How do I 开发者_StackOverflow中文版make a HTML table have the following format:
----------------------------------------------------
| Header1 | Header2 | Header3 |
----------------------------------------------------
| | | |
| | | |
| | | |
What do I have to add or change in my CSS file:
body
{
font-family: "Lucida Console";
}
div, p, th, td
{
font-size: 14px;
}
table
{
border: 1px solid black;
border-collapse: collapse;
margin-left: auto;
margin-right: auto;
}
th
{
background-color: black;
color: white;
padding: 10px;
}
td
{
padding: 5px;
}
Try something like:
td
{
border-left: 1px solid black;
}
th
{
border: 1px solid black;
}
Add border-right to your td style and border to your th style
You need to specify the borders you want. Use border-right and border-left on your css to acomplish the effect you want on the required cells only.
精彩评论