Book HomeCascading Style Sheets: The Definitive GuideSearch this book Thursday 23rd of March 2017 09:03:52 PM

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 XML parsers make your application code more reliable and quick to develop by providing validity checking on your XML documents (if you use a DTD).

  • XML allows you to easily generate XML documents (that contain your information), since it is so structured.
  • XML parsers allow you to code faster by giving you a parser for your all your XML documents (with and without DTDs).
  • XML documents are easily committed to a persistence layer

    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:


    Library Navigation Links

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

    specifications explicitly state that user agents are not required to reflow previous content to accommodate things that happen later in the document. In other words, if an image is floated up into a previous paragraph, it may simply overwrite whatever was already there. On the other hand, the user agent may handle the situation by flowing content around the float, even though doing so isn't required behavior. Either way, it's probably a bad idea to count on a particular behavior, which makes the utility of negative margins on floats rather limited. Hanging floats are probably fairly safe, but trying to push an element upward on the page is generally a light purple background. There are almost infinite possibilities:defining red text for warnings, using a dark purple to make boldfacedtext even more obvious, setting each heading to be a different shadeof green, and on and on.

    Of course, this means that when you're designing a page, youneed to put some thought into it first. That's generally truein any case, but with colors, it's even more so. For example,if you're going to set all hyperlinks to be yellow, will thatclash with the background color in any part of your document? If you

    The width is then set to the value necessary toreach the required total, as demonstrated in Figure 8-16.

    Figure 8-16

    Figure 8-16. Setting an explicit right margin

    Finally, what happens when all three properties are set toauto ? The answer is simple: both margins are setto zero, and the width is made as wide aspossible. This result is the same as the default situation when thereare no values explicitly declared for margins or the width. In such acase, the margins default to zero (0) and the color is the foreground color of the element. Thus, the followingdeclaration will be displayed as shown in Figure 7-44:

    P.shade1 {border-style: solid; border-width: thick; color: gray;}P.shade2 {border-style: solid; border-width: thick; color: gray;border-color: black;}

    The result is that the first paragraph has a gray border, havingtaken the value gray from the foreground color ofthe paragraph itself. The second paragraph, on the other hand, has ablack border because that color was explicitly assigned using

    In theory, a user agent would have to double the size of anchor text as the pointer hovers over it, which could well cause major redisplay issues. An author could cause similar problems by declaring that TEXTAREA elements should change their size when they are in focus. User agents are not required to reflow the document based on styles assigned to these pseudo-elements, although some may do so -- it remains to be seen.