Tips on using CSS with XML/TEI

From TEIWiki
Revision as of 16:25, 4 March 2008 by Brettz9 (talk | contribs) (small fix on CSS class referent)
Jump to navigation Jump to search

For those who are fairly familiar with using CSS with HTML or XHTML, one might be familiar enough with how to define colors, etc., but still remain unaware of how to make a simple stylesheet.

Since one cannot use .class-name as in X/HTML (though some processors might be able to use xml:id to be the target of the # id selector), one first ought to be familiar with the generic attribute selectors.

For example,

<div type="chapter">...

Could be styled with:

div[type="chapter"] {}

Another important adjustment to make is that while X/HTML defines a default display behavior (e.g., <p> in HTML is block while <span> in HTML is inline), other XML is more generic and forces you to define which elements out to be defined as block (they will otherwise be rendered inline).

For example, for TEI, you might define the following:

p, div, div1, div2, div3 {display:block}

You can also specify inline elements by using display:inline