HTML & XHTML
Authors: Powell Th.A.
Published year: 2003
Pages: 211-212/252
Buy this book on amazon.com >>
 <  Day Day Up  >  


CSS Color Values

Cascading style sheets (CSS) support the color names and values listed above and also offer a number of other formats not available in HTML.

Three-Digit Hexadecimal Color Values

Under CSS, color values can be defined using three-digit hexadecimal color values, a concise version of the six-digit values just noted. This approach is supported by Internet Explorer 3 and higher and Netscape Navigator 4 and higher.

span {font-family: Helvetica; font-size: 14pt; color: #0CF;}

RGB Color Values

Under CSS, color values can be defined using RGB values. Colors are defined by the letters rgb, followed by three numbers between 0 and 255 that are contained in parentheses, separated by commas, and with no spaces between them. This approach is supported by Internet Explorer 4 and higher and Netscape Navigator 4 and higher.

p {color: rgb(204,0,51);}

RGB Color Values Using Percentages

Under CSS, RGB color values can also be defined using percentages. The format is the same, except that the numbers are replaced by percentage values between 0% and 100%. This approach is supported by Internet Explorer 4 and higher and Netscape Navigator 4 and higher.

p {color: rgb(75%,10%,50%);}



 <  Day Day Up  >  
 <  Day Day Up  >  


Appendix F: Reading a Document Type Definition

This appendix presents the Document Type Definitions (DTDs) for XHTML 1.0. Traditional HTML "dialects" are defined using SGML (Standard Generalized Markup Language), a complex language with many nuances . Modern XHTML dialects are developed in XML (eXtensible Markup Language), which is a subset of SGML and slightly easier to work with. This appendix presents the small amount of SGML or XML knowledge needed to read the various DTDs directly.

Element Type Declarations

Two common types of declarations should be familiar to Web developers: element type declarations and attribute list declarations. Beyond these, the less familiar declarations for general and parameter entities are not very complicated.

An element type declaration defines three characteristics:

  • The element type's name , also known as its generic identifier

  • Whether start and end tags are required, forbidden (end tags on empty elements), or may be omitted

  • The element type's content model, or what content it can enclose

All element type declarations begin with the keyword ELEMENT and have the following form:


<!ELEMENT name content_model >

The declaration for the XHTML br element gives a simple example:


<!ELEMENT br EMPTY>

This case says we have a br element that contains no content at all-it is empty, as shown by the keyword EMPTY .

In the case of traditional HTML, which is defined using SGML, we see a different syntax that defines


<!ELEMENT name minimization content_model >

In the traditional HTML 4.0 DTD we see


<!ELEMENT BR - O EMPTY>

Here, tag minimization is declared by two parameters that indicate the start and end tags. These parameters may take one of two values. A hyphen indicates the tag is required. An uppercase "O" indicates it may be omitted. The combination of "O" for the end tag and the content model EMPTY means the end tag is forbidden. Thus, under traditional HTML the <br> tag requires a start tag but not an end tag. Because the <br> tag does not contain content, its content model is defined by the keyword EMPTY just as it did in the XHTML specification.

Most HTML and XHTML elements enclose content. If a content model is declared, it is enclosed within parentheses and known as a model group . The HTML 4.0 declaration for a selection list option gives an example:


<!ELEMENT OPTION - O (#PCDATA)*>

The XHTML equivalent is almost identical save the casing of the element itself and the lack of the minimization information.


<!ELEMENT option (#PCDATA)>

Note in both cases the content model group contains the keyword #PCDATA . This stands for parsed character data -character content that contains no element markup but that may contain entity symbols for special characters . Keywords such as #PCDATA and CDATA are discussed in the section "SGML and XML Keywords."



 <  Day Day Up  >  
HTML & XHTML
Authors: Powell Th.A.
Published year: 2003
Pages: 211-212/252
Buy this book on amazon.com >>

Similar books on Amazon