Book HomeCascading Style Sheets: The Definitive GuideSearch this book Friday 31st of July 2015 09:23:15 AM

10.6. Borders

In CSS1, there are quite a few properties devoted to setting borders around element boxes, such as border-top-width and border-color, not to mention border itself. CSS2 adds a even more border properties, most of which are aimed at giving the author even more specific control of the borders. Before, it was difficult to set a specific color or style for a given side of the border, except through properties like border-left, and that could require more than one value. The new CSS2 properties address this, and their names are pretty self-explanatory:

margin-left: 10px; border: 3px solid gray;}
<DIV STYLE="width: 420px; background-color: silver;
padding: 10px; margin-top: 75px;">
<P CLASS="neg">
A paragraph.
The next paragraph.
border-top-style border-right-style border-bottom-style border-left-style

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.

border-top-style, since no such property exists in CSS1 (although that property, and others like it, were introduced in CSS2). You can, however, sneak around this limitation by declaring the style for a given border using one of the shorthand properties we'll discuss later in the chapter. Falling back on solid

There is one interesting thing about CSS that can make life difficult