HTML and CSS Reference
In-Depth Information
Q Is it possible to change the amount that list items are indented or remove the
indentation entirely?
A Yes, the properties used to control list indentation are margin-left and padding-
left . Some browsers use one and some use the other, so you need to set both of
them to change the indentation for your lists. If you set them both to zero, the text
in the list will be aligned with the left side of the container, and the bullets or num-
bers will actually be outside the container.
Q I've seen HTML files that use <li> outside a list structure, alone on the page,
like this:
<li> And then the duck said, “put it on my bill” </li>
A Most browsers at least accept this tag outside a list tag and format it either as a
simple paragraph or as a nonindented bulleted item. According to the true HTML
specification, however, using an <li> outside a list tag is illegal, so good HTML
pages shouldn't do this. Enclosing list items within list tags is also required by the
XHTML recommendation. Always put your list items inside lists where they
belong.
Quiz
1. Ordered and unordered lists use the <li> tag for list items; what tags are used by
definition lists?
2. Is it possible to nest an ordered list within an unordered list or vice versa?
3. Which attribute is used to set the starting number for an ordered list? What about
to change the value of an element within a list?
4. What are the three types of bullets that can be specified for unordered lists using
the list-style-type CSS property?
5
Quiz Answers
1. Definition lists use the <dt> and <dd> tags for list items.
2. Yes, you can nest ordered lists within unordered lists or vice versa. You can also
nest lists of the same type, too.
3. With the <ol> tag, the start attribute is used to specify the starting value for the list.
To change the numbering within a list, the value attribute is used. Subsequent
items are numbered from the most recent value that's specified.
4. The bullet types supported by the list-style-type property are disc , circle , and
square . The default is disc .
 
Search WWH ::




Custom Search