X hits on this document

457 views

0 shares

1 downloads

0 comments

33 / 142

Rendering XML with cascading style sheets

note { display: block; } para { display: block; margin-bottom: 1em;

}

In this CSS file there are two selectors corresponding to each of the elements in the XML file: note and para. Each selector is associated with one or more name/value pairs (declarations) describing how the content of the elements are to be displayed. Each name is separated from the value by a colon (:), the name/value pairs are separated from each other by a semicolon (;), and all the declarations associated with a selector are grouped together with curly braces({}).

Opening note.xml in a relatively modern Web browser should result in something looking like this:

Be forewarned. Not all web browsers support CSS similarly. (What a surprise!) In general, you will get minimal performance from Netscape Navigator 4.7 and Internet Explorer 5.0. Much better implementa- tions of CSS are built into Mozilla 1.0 and Internet Explorer 6.0. Your milage will vary.

The key to using CSS files is knowing how to create the name/value pair declarations. For a compre- hensive list of these name/value pairs see the World Wide Web Consortium's description of CSS [http://www.w3.org/TR/REC-CSS2/propidx.html] . A number of them are described below.

display

The display property is used to denote whether or not an element is to be displayed, and if so, how but only in a very general way. The most important values for display are: inline, block, list-item, or none. Inline is the default value. This means the content of the element will not include a line break after the content; the content will be displayed as a line of text. Giving display a value of block does create line breaks after the content of the element. Think of blocks as if they were paragraphs. The list-item value is like block, but it also indents the text just a bit. The use of none means the content will not be displayed; the content is hidden. Examples include:

  • display: none;

  • display: inline;

25

Document info
Document views457
Page views463
Page last viewedFri Dec 09 08:29:17 UTC 2016
Pages142
Paragraphs3126
Words34660

Comments