Introduction
HTML, or Hypertext Markup Language, is the primary language for structuring web pages. It collaborates with CSS and JavaScript to define content, appearance, and behavior. HTML comprises elements enclosed in angle brackets, encompassing various webpage components like headings, paragraphs, images, and links. The standard structure includes the , , and elements. HTML facilitates hyperlink creation through the tag, enabling seamless navigation between web pages. HTML5, the latest version, introduces new elements and attributes, enhancing web functionality and accessibility. In essence, HTML serves as the foundation for creating structured, interactive web content, essential for web development and design.

Nested lists and list formatting
About Lesson

Nested lists in HTML allow you to create hierarchical structures within lists, where one list is contained within another. Additionally, you can apply formatting to lists to customize their appearance. Here’s how to work with nested lists and format lists:

1. **Nested Lists:**
– To create nested lists, place one list (`<ul>` or `<ol>`) inside another list item (`<li>`).
– Example of a nested unordered list:
“`html
<ul>
<li>Main item 1</li>
<li>Main item 2
<ul>
<li>Nested item 1</li>
<li>Nested item 2</li>
</ul>
</li>
<li>Main item 3</li>
</ul>
“`
– In this example, “Main item 2” contains a nested unordered list with two items.

2. **List Formatting with CSS:**
– You can use CSS to customize the appearance of lists, including list items and bullets.
– Common CSS properties for formatting lists include `list-style-type`, `list-style-position`, and `list-style-image`.
– Example of formatting an unordered list with square bullets:
“`html
<style>
ul {
list-style-type: square;
}
</style>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
“`

3. **List Indentation:**
– By default, nested lists are indented to visually indicate their hierarchical structure.
– Use CSS margin or padding properties to adjust the indentation of lists.
– Example of increasing the left margin of nested lists:
“`html
<style>
ul ul {
margin-left: 20px;
}
</style>
<ul>
<li>Main item 1</li>
<li>Main item 2
<ul>
<li>Nested item 1</li>
<li>Nested item 2</li>
</ul>
</li>
<li>Main item 3</li>
</ul>
“`

4. **List Item Styles:**
– You can apply specific styles to list items (`<li>`) to customize their appearance, such as font size, color, or background.
– Example of styling list items with a background color:
“`html
<style>
li {
background-color: #f0f0f0;
}
</style>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
“`

By utilizing nested lists and applying CSS formatting, you can create visually appealing and structured lists in your HTML documents. Experiment with different CSS properties to achieve the desired styling for your lists.

Join the conversation