Lec 17 (HTML List)
Lec 17 (HTML List)
HTML Lists
▸ HTML Lists are used to specify lists of information. All lists may contain
one or more list elements. There are three different types of HTML lists:
2
Ordered List
▸ In the ordered HTML lists, all the list items are marked with numbers by
default.
▸ The ordered list starts with <ol> tag and the list items start with <li> tag.
3
Ordered List Example
<html>
<body>
Type Description
type="I" The list items will be numbered with uppercase roman numbers
type="i" The list items will be numbered with lowercase roman numbers
5
Ordered List Type Attribute
<html>
<body>
<!----- Ordered List --->
<ol type="A">
<li>GM</li>
<li>Ahemd</li>
<li>Nazir</li>
<li>Aamir</li>
</ol>
</body>
</html>
6
Ordered List start attribute
▸ The start attribute is used with ol tag to specify from where to start the list
items.
<ol type="1" start="5"> : It will show numeric values starting with "5".
<ol type="A" start="5"> : It will show capital alphabets starting with "E".
<ol type="a" start="5"> : It will show lower case alphabets starting with "e".
<ol type="I" start="5"> : It will show Roman upper case value starting with "V".
<ol type="i" start="5"> : It will show Roman lower case value starting with "v".
7
Ordered List Type Attribute
<li>GM</li>
<li>Ahemd</li>
<li>Nazir</li>
<li>Aamir</li>
</ol>
8
Unordered List
▸ In HTML Unordered list, all the list items are marked with bullets.
▸ The Unordered list starts with <ul> tag and list items start with the <li> tag
9
Unordered List Example
<html>
<body>
</body>
</html>
10
UnOrdered List Type Attribute
▸ The CSS list-style-type property is used to define the style of the list item
marker:
Value Description
11
UnOrdered List Type Attribute
▸ The CSS list-style-type property is used to define the style of the list item
marker:
<html>
<body>
<!----- UnOrdered List --->
<ul style="list-style-type:circle;">
<li>Karachi</li>
<li>Hyderabad</li>
<li>Sukkur</li>
<li>Larkana</li>
</ul>
</body></html>
12
Description Lists
▸ HTML Description list is also a list style which is supported by HTML and
XHTML.
▸ It is also known as definition list where entries are listed like a dictionary or
encyclopedia.
▸ The definition list is very appropriate when you want to present glossary, list
of terms or other name-value list.
13
Description Lists
▸ The HTML definition list contains following three tags:
14
Description Lists Example
<html>
<body>
<!----- Description List --->
<dl>
<dt>Karachi</dt>
<dd>Karachi is the capital city of Sindh</dd>
<dt>Lahore</dt>
<dd>Lahore is the capital city of Punjab</dd>
</dl>
</body></html>
15
Nested List
▸ A list within another list is termed as nested list.
▸ If you want a bullet list inside a numbered list then such type of list will called
as nested list.
16
Nested List Example
<!----- Nested List --->
<ol>
<li>Sindh
<ul>
<li>Karachi</li>
</ul>
</li>
<li>Punjab
<ul>
<li>Lahore</li>
</ul>
</li>
</ol>
</body></html>
17
THANKS!
Any questions?
18