Book HomeCascading Style Sheets: The Definitive GuideSearch this book Friday 27th of May 2016 02:13:09 PM

10.5. Adapting to the Environment

CSS2 offers the ability to both alter the browser's environment and integrate its look more closely to that of the user's operating system.

10.5.1. Cursors

To achieve the former, we have the cursor property, which lets you declare what shape the browser's cursor will take as it passes over a given element. Want to make a humorous point about download times? Change the cursor to the wait cursor (an hourglass or watch) when the cursor passes over hyperlinks. You can even hook this property up to "cursor files" (which are not defined by the specification), so you could theoretically class your anchors based on where they go and load different icons for each type of link. For example, off-site links could cause the cursor to change into a globe, while links intended to provide help could trigger a question-mark cursor.

10.5.2. Colors

In order to let web pages more closely match the user's desktop environment, there are a whole list of new color keywords like button-highlight, three-d-shadow, and gray-text. These are all intended to use the colors of the user's operating system. In all, there are 27 of these new color keywords. I won't list them all out here, but they're listed in Table 10-1, found at the end of this chapter.

WARNING

Borders cannot be applied to inline elements inNavigator 4.x orExplorer4.x/5.x. Only Opera 3.x draws borders aroundinline elements, and it only caps the beginning and end of theelement. This is in agreement with the CSS specification, althoughthis is not discussed here (see Chapter 8, "Visual Formatting", formore details).

10.5.3. Outlines

While you're moving your cursor around, you might want to show where the focus is set. For example, it might be nice to define a button so that it gets a red box around it when the cursor moves over it. Well, there a number of outline properties, including outline, outline-color, outline-style, and outline-width. To use the example of a red box, you might declare:

IMG.button:hover {outline: solid red 1px;}

This should have the effect described. The outline styles could also be used to set a visible outline for regions in a client-side image map.



Library Navigation Links

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

Finally, the third list item in the source is a child of an orderedlist, but the OL element is the child of anLI element, so it doesn't match either.

10.2.1.3. Adjacent-sibling selector

If you thought that was interesting,consider our next subject: the adjacent siblingselector. This is in some ways like the child selector,the borders and the content area, we find the padding of the element box. It will come as no surprise that the simplest property used to affect this area is called padding.

padding

Values
bullet's position is set to outside, it will appear the way list items always have on the Web, as you can see in Figure 7-85:

LI {list-style-position: outside;}
Figure 7-85

Figure 7-85. Placing the bullets outside list items

Should you desire a slightly different appearance, though, you can pull the bullet in toward the content by setting the value to be inside:

DTDs are a simple way to make sure that 2 or more XML documents are of the same "type". Its a very limited approach to making "typed" XML documents shareable across systems. In the future some kind of schema system will be proposed by the W3C that should allow typing, instantiation and inheritance of information (in XML).

XML enables interoperability

All of the advantages of XML outlined so far all make interoperability possible. This is one of the most important requirements for XML, to enable disparate systems to be able to share information easily.

By taking the lowest common denominator approach, by being web enabled, protocol independent, network independent, platform independent and extensible, XML makes it possible for new systems and old systems (that are all different) to communicate with each other. Encoding information in plain text with tags is better than using propietary and platform dependent binary formats.

Vision

inside the margin. The CSS specification strongly implies that thebackground extends to the outside edge of the border, since it talksabout the borders being drawn "on top of the background of theelement," but not all browsers seem to agree. This is importantbecause some borders are "intermittent" -- forexample, dotted and dashed styles -- and the element'sbackground should appear in the spaces between the visible portionsof the border.

Every border has three aspects: its width, or thickness; its style,