This is the second lesson of HTML and CSS. This presents how to use lists and table in HTML. The slide also describes tags of lists and tables. CSS properties are used to style tables.
3. Tags Description
<ol> Defines an ordered list
<ul> Defines an unordered list
<li> Defines list items
<dl> Defines a description list
<dt> Defines a name in a description list
<dd> Describes the name in a description
list
4. Ordered List
Starts with the <ol> tag
and each list item starts
with the <li> tag. The list
items is marked with
numbers by default:
Example:
<ol>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>
Unordered List
An unordered list starts with
the <ul> tag and each list
item starts with the <li> tag.
The list items is marked with
bullets by default.
Example:
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
5. Is a list of terms, having a description for each name.
Example:
<!DOCTYPE html>
<html>
<body>
<h3>A Description List</h3>
<dl>
<dt>HTML</dt>
<dd>-Hypertext Markup Language</dd>
<dt>CSS</dt>
<dd>-Cascading Style Sheet</dd>
</dl>
</body>
</html>
A Description List
HTML
-Hypertext Markup Language
CSS
-Cascading Style Sheet
6. Style it by writing : list-style-type
Defines the style of the list item marker
There are 4 types of styling the list.
Circle : Sets the list item marker to a circle.
Disc : Sets the list item marker to a disc. This is the
default style.
Square :Sets the list item marker to a square
None :Sets the list item marker to none. The list
items will not be marked.
9. list-style-type:square
<!DOCTYPE html>
<html>
<body>
<h3>Unordered List with Square
Bullets</h3>
<ul style="list-style-type:square;">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</body>
</html>
Unordered List with SquareBullets
HTML
CSS
JavaScript
10. list-style-type:none
<!DOCTYPE html>
<html>
<body>
<h3>Unordered List with None
Bullets</h3>
<ul style="list-style-type:none;">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</body>
</html>
Unordered List with None Bullets
HTML
CSS
JavaScript
11. The type attribute in the <ol> tag, defines the type of
item marker in the list.
Type Description
type=“1” The items in the list will be marked with
numbers
type=“A” The items in the list will be marked with
uppercase letters
type=“a” The items in the list will be marked with
lowercase letters
type=“I” The items in the list will be marked with
uppercase roman number
type=“i” The items in the list will be marked with
lowercase roman number
12. Type=“1”
<!DOCTYPE html>
<html>
<body>
<h3>Ordered List with number
(default)</h3>
<ol type=“1">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>
</body>
</html>
Ordered List with number (default)
1. HTML
2. CSS
3. JavaScript
13. type=“a”
<!DOCTYPE html>
<html>
<body>
<h3>Ordered List with Lowercase
Letters</h3>
<ol type=“a">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>
</body>
</html>
Ordered List with Lowercase
Letters
a. HTML
b. CSS
c. JavaScript
14. type=“A”
<!DOCTYPE html>
<html>
<body>
<h3>Ordered List with Uppercase
Letters</h3>
<ol type="A">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>
</body>
</html>
Ordered List with Uppercase
Letters
A. HTML
B. CSS
C. JavaScript
15. type=“I”
<!DOCTYPE html>
<html>
<body>
<h3>Ordered List with Uppercase
Roman Numbers</h3>
<ol type=“I">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>
</body>
</html>
Ordered List with Uppercase Roman
Numbers
I. HTML
II. CSS
III. JavaScript
16. type=“i”
<!DOCTYPE html>
<html>
<body>
<h3>Ordered List with Lowercase
Roman Numbers</h3>
<ol type=“i">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>
</body>
</html>
Ordered List with Lowercase Roman
Numbers
i. HTML
ii. CSS
iii. JavaScript
18. Tags Description
<table> Defines a table
<th> Defines table header. The elements inside are bold and
centered
<tr> Defines row of the table
<td> Defines cell of the table
<caption> Defines a caption
<colgroup> Specifies a group of one or more columns in a table
<col> Specifies column property
<thead> The header content is grouped within the tag
<tbody> The content of the body is grouped within the tag
<tfoot> The footer content is grouped within the tag
20. CSS property Description
border Defines a border to the table
border-collapse Defines a border to each cells of the
table
padding Add padding to the cells
Text-align Aligns text of the cell (left, right,
center)
Border-spacing Sets space in between the cells
width Defines width of the table
26. Lists in HTML: Ordered, Unordered, and description.
Table in HTML
Styled table with CSS property
27. 1. Create a page that shows shopping list. Use Ordered
list, type roman numbers.
2. In the same page use unordered list of type square to
display list of books.
3. In the same page, add a table showing address book of
5 people. Use colspan and row span attribute. Style the
table accordingly.