HTML validation

Joined
Jul 4, 2023
Messages
370
Reaction score
41
In very simple words, <ul> element is a container for <li> elements, if you want to nest lists you must always use at least one <li> element.

HTML:
<ul>
  <li>parent 1
  
    <ul>
      <li>child 1 of parent 1 - parent 2
      
        <ul>
          <li>child 1 of parent 2</li>
          <li>child 2 of parent 2 - parent 3
          
            <ul>
              <li>child 1 of parent 3</li>
            </ul>
          
          </li>
        </ul>
      
      </li>
    </ul>
  
  </li>
</ul>
 
Joined
Sep 4, 2022
Messages
129
Reaction score
16
"ul" indicates a depth-level. the more you nest ul in ul, the more nested level you have.


HTML:
<ul>Depth : 0  !root
  <ul>Depth : 1  !first level under
    <ul>Depth : 2  !second level under</ul>
  </ul>
</ul>

<ul>Depth : 0  !root
  
  <ul>Depth : 1  !first level under
      <br> datas 1-1
      <br> datas 1-2
  
      <ul>Depth : 2  !second level under
         <br> datas 2-1
         <br> datas 2-2
      </ul>
    
   </ul>
  
</ul>

ol exists too, with incremented value, and others display features.

ol = ordered List ( with value for each )
ul = unordered List ( without value )
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,297
Latest member
EngineerD

Latest Threads

Top