HTML and CSS Reference
In-Depth Information
Element-Specific Attributes
type
This attribute indicates the bullet type used in unordered lists or the numbering type
used in ordered lists. For ordered lists, a value of
a
indicates lowercase letters,
A
indicates
uppercase letters,
i
indicates lowercase Roman numerals,
I
indicates uppercase Roman
numerals, and
1
indicates numbers. For unordered lists, values are used to specify bullet types.
Although the browser is free to set bullet styles, a value of
disc
generally specifies a filled
circle, a value of
circle
specifies an empty circle, and a value of
square
specifies a filled
square. This attribute should be avoided in favor of the CSS property
list-style-type
.
value
This attribute indicates the current number of items in an ordered list as defined by
an
<ol>
tag. Regardless of the value of
type
being used to set Roman numerals or letters,
the only allowed value for this attribute is a number. List items that follow will continue
numbering from the value set. The
value
attribute has no meaning for unordered lists.
CSS 2 counters can provide much more flexibility than this attribute.
Examples
<ul>
<li type="circle">
First list item is a circle
</li>
<li type="square">
Second list item is a square
</li>
<li type="disc">
Third list item is a disc
</li>
</ul>
<ol>
<li type="i">
Roman Numerals
</li>
<li type="a" value="3">
Second list item is letter C
</li>
<li type="a">
Continue list in lowercase letters
</li>
</ol>
Compatibility
HTML 2, 3.2, 4, 4.01, 5
XHTML 1.0, 1.1, Basic
Firefox 1+, Internet Explorer 2+,
Netscape 1+, Opera 4+, Safari 1+
Notes
• Under the strict HTML and XHTML definitions, the
li
element loses the
type
and
value
attributes, as these presentation styles can be emulated with CSS properties
like
list-item-style
and CSS counters.
• HTML5 reintroduces the
value
attribute to list items but CSS should be used
instead.
• Whereas bullet styles can be set explicitly, browsers tend to change styles for bullets
when
<ul>
lists are nested. However, ordered lists generally do not change style
automatically, nor do they support outline-style numbering (1.1, 1.1.1, and so on).
CSS rules, of course, can do this.
• The closing tag
</li>
is optional under HTML specifications, including HTML5.
However, it is required under XHTML and should always be used.