Chapter 2 HTML
Chapter 2 HTML
• HTML Elements: usually consists of a start tag and end tag, with
the content inserted in between:
• <tagname>Content goes here...</tagname>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
• HTML Hyper Links: defined with the <a> tag:
• The href Attribute: HTML links are defined with the <a> tag.
The link address is specified in the href attribute:
<tagname style="property:value;">
• HTML Background Color
<body style="background-color:powderblue;">
• HTML Text Color
• HTML Comments
List Tags
Tag Description
<ol> Defines an ordered list
<ul> Defines an unordered list
<li> Defines a list item
<dl> Defines a definition list
<dt> Defines a definition term
<dd> Defines a definition description
<dir> Deprecated. Use <ul> instead
<menu> Deprecated. Use <ul> instead
Different types of ordered lists
Numbered list Letters list
<html>
<html> <body>
<body> <h4>Letters list:</h4>
<h4>Numbered list:</h4> <ol type="A">
<ol> <li>Apples</li>
<li>Apples</li> <li>Bananas</li>
<li>Bananas</li> <li>Lemons</li>
<li>Lemons</li> <li>Oranges</li>
<li>Oranges</li> </ol>
</ol> </body></html>
Cont…….
Lowercase letters list Roman numbers list
<html>
<html><body>
<body>
<h4>Roman numbers
<h4>Lowercase letters
list:</h4>
list:</h4>
<ol type="I">
<ol type="a">
<li>Apples</li>
<li>Apples</li>
<li>Bananas</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Lemons</li>
<li>Oranges</li>
<li>Oranges</li>
</ol> </html></body
</ol> </body>
Lowercase Roman numbers list
<html><body>
<h4>Lowercase Roman
numbers list:</h4>
<ol type="i">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li>
</ol>
</body></html>
Unordered Lists
• An unordered list is a list of items. The list items are marked with
bullets (typically small black circles).
• An unordered list starts with the <ul> tag. Each list item starts with
the <li> tag.
Circle bullets list(0 )
Disc bullets list( )
<html><body>
<html> </ul><h4>Circle bullets
<body> list:</h4>
<h4>Disc bullets list:</h4> <ul type="circle">
<ul type="disc"> <li>Apples</li>
<li>Apples</li> <li>Bananas</li>
<li>Bananas</li> <li>Lemons</li>
<li>Lemons</li> <li>Oranges</li>
<li>Oranges</li> </ul>
<html><body> <body><html>
Square bullet Nested list
This example demonstrates how
</body></html>
you can nest lists.
<h4>Square bullets list:</h4> <html><body>
<h4>A nested List:</h4>
<ul type="square">
<ul>
<li>Apples</li> <li>Coffee</li>
<li>Tea<ul><li>Black tea</li>
<li>Bananas</li>
<li>Green tea</li>
<li>Lemons</li> </ul>
</li>
<li>Oranges</li>
<li>Milk</li>
</ul> </ul>
</body>
</body>
</html>
</html>
Definition List
• Specified using the tag:
<DL> ……… </DL>
• Each definition comprises of a definition term (<DT>) and a
definition description (<DD>).
• Web browsers format each definition on a new line and indent it.
Example:
<DL>
<DT> TCP
<DD> Transmission Control Protocol
<DT> UDP
<DD> User Datagram Protocol
<DT> IP
<DD> Internet Protocol
</DL>
Definition List (Example)
<html>
<head><title> Definition list 1 </title></head>
<body text=white bgcolor=blue>
<h2> Some important protocols: </h2>
<h3><DL>
<DT> TCP
<DD> Transmission Control Protocol
<DT> UDP
<DD> User Datagram Protocol
<DT> IP
<DD> Internet Protocol
</DL></h3>
</body>
</html>
Nesting of Lists