Using Lists for Structuring Content In HTML Skip to main content

Featured

Using Lists for Structuring Content In HTML

 Program:

<!DOCTYPE html>

<html>

<body>

    <h2>Things to Do</h2>

    <ul>

        <li>Go for a walk</li>

        <li>Read a book</li>

        <li>Write code</li>

    </ul>

</body>

</html>

Explanation:

  • <ul> creates an unordered list.
  • <li> represents list items in an unordered sequence (bulleted list).

Definition List:

<!DOCTYPE html>
<html>
<body>
    <h2>Glossary</h2>
    <dl>
        <dt>HTML</dt>
        <dd>HyperText Markup Language</dd>
        <dt>CSS</dt>
        <dd>Cascading Style Sheets</dd>
    </dl>
</body>
</html>

Explanation:

  • <dl> creates a definition list.
  • <dt> defines a term in the list.
  • <dd> represents the description of the term.
Questions and Answers:

Question 1: What does the <ul> tag do in HTML? 

Answer 1: The <ul> tag in HTML is used to create an unordered list, or a bulleted list.

Question 2: How do you define each list item in an unordered list? 

Answer 2: The <li> tag is used to define each list item in an unordered list.

Question 3: What is the purpose of the <dl> tag in HTML?

Answer 3: The <dl> tag in HTML is used to create a definition list.

Question 4: How do you define a term in a definition list? 

Answer 4: The <dt> tag is used to define a term in a definition list.

Question 5: How do you provide a description for a term in a definition list?

Answer 5: The <dd> tag is used to provide a description for a term in a definition list.

Comments

Popular Posts