Tips on using CSS with XML/TEI

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 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,

Could be styled with:

Another important adjustment to make is that while X/HTML defines a default display behavior (e.g., in HTML is block while 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:

You can also specify inline elements by using