HTML and CSS Reference
In-Depth Information
Switching Between Uppercase and Lowercase
he
text-transform
property converts text to use initial caps, all lowercase, or all uppercase. It's supported by all
browsers, and accepts the following values:
capitalize
Convert to uppercase the first letter after every space.
lowercase
Convert all characters to lowercase.
uppercase
Convert all characters to uppercase.
none
No conversion.
he
text-transform
property is inherited, so it affects all child elements. Set the value to
none
in a child
element to turn off an inherited text transformation rule.
Controlling Whitespace and Line Wrapping
Browsers automatically close up sequences of spaces, ignore new lines in HTML, and wrap text at the right
edge. he
white-space
property gives you control over the handling of whitespace and new lines. It accepts the
following values:
normal
This is the default value and is used to cancel any inherited value.
pre
Preserve all spaces and new lines in the HTML.
nowrap
Prevent the browser from automatically wrapping text.
pre-line
Close up sequences of whitespace as in normal text, but honor new lines.
Not supported in IE 6-7.
pre-wrap
Preserve sequences of whitespace and new lines, but automatically wrap text
when the border is reached. Not supported in IE 6-7.
Using
pre
has a similar effect to
<pre>
tags in HTML, but with the advantage of preserving the current font.
It's useful for displaying poetry without the need to insert
<br>
tags at the end of each line. You can also use
spaces to indent lines.
There are examples of each value of
white-space
in
white-space.html
. Figure
4-13
shows the results. The
section with the gray background illustrates the effect of text wrapping.