HTML - tags - li tag

revision:


Content

"li" tag : defines an item in a list syntax some examples


"li" tag : defines an item in a list

top

The <li> tag defines a list item. The tag is used inside ordered lists(<ol>), unordered lists (<ul>), and in menu lists (<menu>).
In "ul" and "menu", the list items will usually be displayed with bullet points. In "ol", the list items will usually be displayed with numbers or letters.

Attributes: the <li> element supports the global attributes and events attributes. One specific attribute for an "ol" list is:

value ; value: number; only for <ol> lists;

specifies the start value of a list item. The following list items will increment from that number.


syntax

top

<li> . . . </li>


some examples

top

The ol element defines an ordered list:

  1. Coffee
  2. Tea
  3. Milk

The ul element defines an unordered list:

Codes:

                    <p class="spec" style="margin-left: 3vw;">The ol element defines an ordered list:</p>
                    <ol style="margin-left: 3vw;">
                        <li>Coffee</li>
                        <li>Tea</li>
                        <li>Milk</li>
                    </ol>

                    <p  class="spec"  style="margin-left: 3vw;">The ul element defines an unordered list:</p>
                        <ul style="margin-left: 3vw;">
                            <li>Coffee</li>
                            <li>Tea</li>
                            <li>Milk</li>
                        </ul>
                
  1. Coffee
  2. Tea
  3. Milk
  4. Water
  5. Juice
  6. Beer

Codes:

                    <ol style="margin-left: 3vw;">
                        <li value="100">Coffee</li>
                        <li>Tea</li>
                        <li>Milk</li>
                        <li>Water</li>
                        <li>Juice</li>
                        <li>Beer</li>
                    </ol>