Wednesday 22nd of November 2017 07:57:39 AM



   WDG's CSS Reference

   WDG's Copyright and Trademark Information

   About the Web Design Group

   Style Sheets Now!

   CSS Quick Tutorial

   CSS Structure and Rules


   Pseudo-classes and Pseudo-elements

   Cascading Order

   CSS1 Units

   CSS Properties

   Linking Style Sheets to HTML

   Style Sheet Dependence

   CSS References

   Syntax Used in CSS Properties

   Font Family

   Font Style

   Font Variant

   Font Weight

   Font Size



   Background Color

   Background Image

   Background Repeat

   Background Attachment

   Background Position


   Word Spacing

   Letter Spacing

   Text Decoration

   Vertical Alignment

   Text Transformation

   Text Alignment

   Text Indentation

   Line Height

   Top Margin

   Right Margin

   Bottom Margin

   Left Margin


   Top Padding

   Right Padding

   Bottom Padding

   Left Padding


   Top Border Width

   Right Border Width

   Bottom Border Width

   Left Border Width

   Border Width

   Border Color

   Border Style

   Top Border

   Right Border

   Bottom Border

   Left Border








   List Style Type

   List Style Image

   List Style Position

   List Style

   Arnoud "Galactus" Engelfriet

   Ian Butler

   Tina Marie Holmboe

   Nick Kew

   HTML 3.2



   CSS Positioning

   Fonts and the Web


   Printing support



   MSIE 3

   Navigator 4.0



   Nick Kew

   BODY element

   HR - horizontal rule

   DD - definition



   LINK element

   HEAD element

   TITLE element


   DFN - definition

   DIV - logical division


   IMG - images

   INPUT element


   A - anchor element

an image has a border, and the BODY is its parent, given this rule:

BODY {color: purple;}

then, by default, the border around the image will be purple. Of course, to get that border to appear, you have to do a little work first.

7.4.1. Borders with Style

H2 {color: rgb(25.5%,40%,98.6%);}

Actually, there is a problem. Some user agents may not recognizedecimal values, and still others couldinterpret them as if the decimal wasn't there, which would leadthem to think the preceding value is actuallyrgb(255%,40%,986%). In that case, assuming theuser agent behaves correctly, the out-of-range values will be"clipped" to the nearest legal value -- in this case,100%. Thus, a user agent which ignores the decimal

Neither is really convenient, given all the typing involved.Fortunately, a better solution is available:

H1 {border-bottom: thick solid gray;}

This will apply the values to the bottom border alone, as shown inFigure 7-45, leaving the others to their defaults.Since the default border style is none, no bordersappear on the other three sides of the element.

Figure 7-45

Figure 7-45. Shorthand properties make styles easier

H1 {font-family: 'Zurich UltraBlack', sans-serif;}H2 {font-family: 'Zurich Black', sans-serif;}H3 {font-family: 'Zurich Bold', sans-serif;}H4, P {font-family: Zurich, sans-serif;}SMALL {font-family: 'Zurich Light', sans-serif;}

Besides the obvious tedium of writing such a style sheet, it onlyworks if everyone has these fonts installed, and it's prettysafe bet that most people don't. It would make far more senseto specify a single font family for the whole document and thenassign weights to various elements. You can do this, in theory, using

XML is structured

When you create your data using an XML editor (that you can write), you can not only input the content of your data, but also define the structural relationships that exist inside your data. By allowing you to define your own tags and create the proper structural relationships in your information (with a DTD), you can use any XML parser to check the validity and integrity of the data stored in your XML documents. This makes it very easy to validate the structure and content of your information when you use XML. Without XML, you could also provide this validation feature at the expense of developing the code to this yourself. XML is a great time saver because most of the features that are available in XML are used by most programmers when working on most projects.

By using XML and Java, you can quickly create and use information that is properly structured and valid. By using (or creating) DTDs and storing your information in XML documents, you have a cross-platform and language independent data validation mechanism (for free) in all your projects!

You might use XML to define file formats to store information that is generated and used by your applications. This is another use of the structured nature of XML. The only limitation is that binary information can't be embedded in the body of XML documents. For example, if you wrote a word processor in Java, you might choose to save your word processor documents to an XML (actually your ApplicationML) file. If you use a DTD then your word processor would also get input file format validation as a feature for free. There are many other advantages to using XML and a file storage format for your applications which will be illustrated later in the chapter.