Showing posts with label nested list. Show all posts
Showing posts with label nested list. Show all posts

Wednesday, 1 June 2011

CSS & HTML: nested lists with style

   


One common mistake that I've found in many web pages is when a nested list is needed. Usually, we think that the following code is correct:
<ul class="list">
<li>A</li>
   <ul class="sublist">
     <li>1</li>
     <li>2</li>
     <li>3</li>
   </ul>
</ul>
Producing this:
  • A
    • 1
    • 2
    • 3
which looks good. But if you try to validate the above code, you will get some errors.