4️⃣

3.4 Lists

3.4 Lists

HTML lists allows web authors to group a set of related items in lists.

Unordered HTML List

An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. The list items will be marked with bullets(small black circles) by default.

Ordered HTML List

An ordered list starts with the <ol> tag. each list item starts with <li> tag. The list items will be marked with numbers by default.

The type attribute changes what the list items will be marked with.

HTML Description Lists

HTML also supports description lists, A description list is a list of terms, with a description of each term. The<dl> tag defines the description list, the<dt> tag defines the term(name),and the <dd> tag describes each term.

<!DOCTYPE html>

<html>
   <head>
      <meta charset = "utf-8">
      <title> Lists</title>
    </head>

<body>
   <ul>
      <li> USA</li>
       <li> Brazil</li>
        <li> Australia
               <ul>
                  <li> Kangaroos</li>
                </ul>
           </li>
       </ul>
 <ol type ="1">
      <li>USA</li>
       <li>Brazil</li>
        <li> Australia</li>
    </ol>
 <ol type ="A">
      <li>USA</li>
       <li>Brazil</li>
        <li> Australia</li>
    </ol>
 <ol type ="a">
      <li>USA</li>
       <li>Brazil</li>
        <li> Australia</li>
    </ol>
 <ol type ="I">
      <li>USA</li>
       <li>Brazil</li>
        <li> Australia</li>
    </ol>
<dl>
  <dt> HTML</dt><dd>- Stands for HyperText Markup Language</dd>
   <dt> CSS </dt> <dd> - Stands for Cascading Style Sheets </dd>
</dl>
</body>

</html>

Previous Section

Next Section

⚖️

Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.