Programming Examples
Create an HTML document with the following lists:
Create an HTML document with the following lists:
(a) An ordered list of your top 3 favorite books.
(b) An unordered list of your hobbies.
(c) A definition list for some common HTML tags (like H1 P)
Solution<!DOCTYPE html>
<html>
<head>
<title>Lists Example</title>
</head>
<body>
<h2>My Favorite Books</h2>
<!-- (a) Ordered List -->
<ol>
<li>Harry Potter and the Sorcerer's Stone</li>
<li>The Alchemist</li>
<li>To Kill a Mockingbird</li>
</ol>
<h2>My Hobbies</h2>
<!-- (b) Unordered List -->
<ul>
<li>Reading</li>
<li>Cooking</li>
<li>Traveling</li>
<li>Photography</li>
</ul>
<h2>Common HTML Tags</h2>
<!-- (c) Definition List -->
<dl>
<dt><h1></dt>
<dd>Defines the largest heading in HTML.</dd>
<dt><p></dt>
<dd>Defines a paragraph of text.</dd>
<dt><a></dt>
<dd>Defines a hyperlink to another page or resource.</dd>
<dt><ul> and <ol></dt>
<dd>Defines unordered (bulleted) and ordered (numbered) lists, respectively.</dd>
</dl>
</body>
</html>
▶ RUN Output/ Explanation: