Cell Borders and CSS

You can use the same border properties that apply to a block of text (paragraph, DIV etc). Use either the shorthand declaration or define each property individually. Use border-top, border-left, border-bottom and border-right to customize individual borders.

HTML Example:

The quick brown fox jumps over the lazy dog The lazy dog jumps over the quick brown fox They jump over each other once again

CSS Example:

td#one {
border-style:solid;
border-width: 3px;
border-color: blue;
}

td#two {
border: 1px dashed red;
}

td#three {
border: 2px double;
border-top-color: red;
border-bottom-color: blue;
}  

Result:

The quick brown fox jumps over the lazy dog The lazy dog jumps over the quick brown fox They jump over each other once again

The same CSS code can be applied to other table elements (THEAD, TH or the whole TABLE). Don't use the same properties for nested elements (like a TABLE and the TD's inside) unless you want to get double borders.

Share

Learn how to design amazing websites