White-Space | W3C Specification: CSS 2.1

NOTE:
This page formerly located at : http://WordpressCenter.net/2006/02/26/white-space-w3c-specification-css-21/ . the URL was modified to insert the decimal point for ‘2.1’
I am sorry for any inconvenience. I hope you have been able to use this resource nonetheless.

I logged this excerpt from the W3C Spec on White-Space to make more clear my entry on the :before Pseudo-element in which I use the Line-Feed Control Character /a to create, essentially, a <br> as part of the generated content.
NOTE: pay close attention to my use of the white-space property therein as well. I use white-space: pre; to compliment the Line-Feed Control Character’s function as applied to the value of the Content Property in the declaratoin of that Pseudo-element. the resulting effect is that of a line break being generated via CSS declaration value! cool, huh?!
16.6 Whitespace: the ‘white-space’ property

‘white-space’
Value: normal | pre | nowrap | pre-wrap | pre-line | inherit
Initial: normal
Applies to: all elements
Inherited: yes
Percentages: N/A
Media: visual
Computed value: as specified

This property declares how whitespace inside the element is handled. Values have the following meanings:

normal
This value directs user agents to collapse sequences of whitespace, and break lines as necessary to fill line boxes.
pre
This value prevents user agents from collapsing sequences of whitespace. Lines are only broken at newlines in the source, or at occurrences of “\A” in generated content.
nowrap
This value collapses whitespace as for ‘normal’, but suppresses line breaks within text.
pre-wrap
This value prevents user agents from collapsing sequences of whitespace. Lines are broken at newlines in the source, at occurrences of “\A” in generated content, and as necessary to fill line boxes.
pre-line
This value directs user agents to collapse sequences of whitespace. Lines are broken at newlines in the source, at occurrences of “\A” in generated content, and as necessary to fill line boxes.

Example(s):

The following examples show what whitespace behavior is expected from the PRE and P elements, the “nowrap” attribute in HTML, and in generated content.

pre { white-space: pre }
p { white-space: normal }
td[nowrap] { white-space: nowrap }
:before,:after { white-space: pre-line }

In addition, the effect of an HTML PRE element with the non-standard “wrap” attribute is demonstrated by the following example:

pre[wrap] { white-space: pre-wrap }

Cascading Style Sheets, level 2 revision 1
CSS 2.1 Specification
W3C Working Draft 13 June 2005
Visual formatting model
http://www.w3.org/TR/CSS21/text.html#white-space-prop

Whatchu do


Leave a Reply

Your email address will not be published. Required fields are marked *