22.12.2013 Views

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Value: [ || || <br />

] | inherit<br />

Initial: not defined for shorthand properties<br />

Applies to: elements with ’display: list-item’<br />

Inherited: yes<br />

Percentages: N/A<br />

Media: visual<br />

The ’list-style’ property is a shorthand notation for setting the three properties<br />

’list-style-type’, ’list-style-image’, and ’list-style-position’ at the same place in the<br />

style sheet.<br />

Example(s):<br />

UL { list-style: upper-roman inside } /* Any UL */<br />

UL > UL { list-style: circle outside } /* Any UL child of a UL */<br />

Although authors may specify ’list-style’ information directly on list item<br />

elements (e.g., LI in HTML), they should do so with care. The following rules look<br />

similar, but the first declares a descendant selector [p. 56] and the second a<br />

(more specific) child selector. [p. 57]<br />

OL.alpha LI { list-style: lower-alpha } /* Any LI descendant of an OL */<br />

OL.alpha > LI { list-style: lower-alpha } /* Any LI child of an OL */<br />

Authors who use only the descendant selector [p. 56] may not achieve the<br />

results they expect. Consider the following rules:<br />

<br />

<br />

WARNING: Unexpected results due to cascade<br />

<br />

OL.alpha LI { list-style: lower-alpha }<br />

UL LI { list-style: disc }<br />

<br />

<br />

<br />

<br />

<strong>level</strong> 1<br />

<br />

<strong>level</strong> 2<br />

<br />

<br />

<br />

<br />

The desired rendering would have <strong>level</strong> 1 list items with ’lower-alpha’ labels<br />

and <strong>level</strong> 2 items with ’disc’ labels. However, the cascading order [p. 73] will<br />

cause the first style rule (which includes specific class information) to mask the<br />

second. The following rules solve the problem by employing a child selector<br />

[p. 57] instead:<br />

OL.alpha > LI { list-style: lower-alpha }<br />

UL LI { list-style: disc }<br />

Another solution would be to specify ’list-style’ information only on the list type<br />

elements:<br />

172

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!