Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question ul vs nested divs

    Hi,

    When I create navigation menus, I typically have html markup this way:

    <div id="mainMenu">
    <div><a href="#">Link 1</a></div>
    <div><a href="#">Link 2</a></div>
    <div><a href="#">Link 3</a></div>
    </div>

    I found many people use ul instead:

    <ul id="mainMenu">
    <li><a href="#">Link 1</a></li>
    <li><a href="#">Link 2</a></li>
    <li><a href="#">Link 3</a></li>
    </ul>


    Both work after some styling, are there advantages using ul ? I believe it's the more popular way, but to me ul needs more works like hiding the bullets and taking away margins and paddings.

    TIA
    Last edited by mattshiao; 09-05-2010 at 07:01 AM. Reason: typo

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Navigation menu is basically a "list" of of links and thus using a list would be more semantic than using passive <div> elements, which do not imply anything to the document. If it's a list, then it'll be rendered with some structure by the browser, even if there's no CSS applied.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •