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>&lt;h1&gt;</dt>
        <dd>Defines the largest heading in HTML.</dd>

        <dt>&lt;p&gt;</dt>
        <dd>Defines a paragraph of text.</dd>

        <dt>&lt;a&gt;</dt>
        <dd>Defines a hyperlink to another page or resource.</dd>

        <dt>&lt;ul&gt; and &lt;ol&gt;</dt>
        <dd>Defines unordered (bulleted) and ordered (numbered) lists, respectively.</dd>
    </dl>

</body>
</html>
▶ RUN

Output/ Explanation:

Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad