XML technologies / XML / XML in a Nutshell / Cascading Style Sheets (CSS) / Text properties
(Excerpt from "XML in a Nutshell" by Elliotte Rusty Harold & W. Scott Means)
Text properties control formatting beyond font changes, including indentation and paragraph alignment. The most common are:
text-indentThe property
text-indentspecifies the indentation of the block’s first line. Indenting all lines generally uses the margin property. Hanging indents are obtained by givingtext-indenta negative value. This property applies only to block elements. For example, this rule indents the first line of the elementgeschichtehalf an inch from the left:
geschichte { text-indent: 0.5in }text-alignThe property
text-aligncan be set toleft,right,centerorjustifyto align text to the block’s left or right edge, center it, or fill the block completely with text. This applies only to block elements.text-decorationThe property
text-decorationcan take the valuesunderline,overline,line-throughorblinkto create effects. Thankfully, CSS2 permits browsers to ignore requests for blinking elements.text-transformThe property
text-transformhas three main values:capitalize,uppercaseandlowercase.uppercasemakes all text uppercase, LIKE THIS.lowercasemakes all text lowercase, like this.capitalizecapitalizes only the first letter of each word, Like This, leaving other letters unchanged. The default isnone, meaning no transformation. It may also be set toinheritto use the parent element’s transformation.Note: Case conversion is relatively easy in English, but more complicated in other languages. Software written by native English speakers often performs poorly with European languages rich in ligatures, such as Maltese, or languages where case matters, such as Arabic. For non-English text, it is therefore best to perform transformations in the source rather than rely on the stylesheet engine to capitalize correctly.
white-spaceThe property
white-spacecontrols text wrapping. In CSS 2, only four values are allowed:normal,pre,nowrapandinherit. In CSS 2.1 the valuespre-wrapandpre-lineare also available.normalis the default, wrapping text when appropriate, as in this paragraph. Withpreall line breaks and spaces are preserved, matching the behavior of the elementprein HTML.nowrapcollapses consecutive spaces but inserts no line breaks.pre-wrapallows wrapping without collapsing consecutive whitespace characters. All source line breaks are also preserved.pre-linecollapses whitespace sequences without converting line breaks to spaces.inheritfinally uses the same behavior as the parent element.
Copyright © 2005 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from the book "XML in a Nutshell" is subject to the same conditions as the printed edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de
back to top