nesting instead of id ing??

Discussion in 'HTML' started by Tim W, Feb 5, 2013.

  1. Tim W

    Tim W Guest

    I am looking at the site template here:
    http://www.html5-templates.co.uk/archive/temps/beadysite/
    The Nav menu is in the html like this:

    <ul>
    <li>
    <h2>Menu </h2>
    <ul>
    <li><a href="index.html">home</a></li>
    <li><a href="#">about us</a></li>
    <li><a href="#">blogs</a></li>
    <li><a href="#">arcade</a></li>
    <li><a href="#">gallery</a></li>
    <li><a href="#">links</a></li>
    <li><a href="#">contact us</a></li>
    <li><a href="#">forums</a></li>
    </ul>
    </li>
    </ul>

    And the Nav has no id but is selected in the css as
    #sidebar li li {.... }

    I realise the futility of sometimes looking for purpose and design in a
    world in which meaning is almost always elusive but here is my question:
    Is it normal or common this nesting of lists instead of giving them a
    class or an id? I have never seen it before. And Why?

    Tim W
     
    Tim W, Feb 5, 2013
    #1
    1. Advertising

  2. Tim W

    dorayme Guest

    In article <kertjr$uv5$>,
    Tim W <> wrote:

    > I am looking at the site template here:
    > http://www.html5-templates.co.uk/archive/temps/beadysite/
    > The Nav menu is in the html like this:
    >
    > <ul>
    > <li>
    > <h2>Menu </h2>
    > <ul>
    > <li><a href="index.html">home</a></li>
    > <li><a href="#">about us</a></li>
    > <li><a href="#">blogs</a></li>
    > <li><a href="#">arcade</a></li>
    > <li><a href="#">gallery</a></li>
    > <li><a href="#">links</a></li>
    > <li><a href="#">contact us</a></li>
    > <li><a href="#">forums</a></li>
    > </ul>
    > </li>
    > </ul>
    >
    > And the Nav has no id but is selected in the css as
    > #sidebar li li {.... }
    >
    > I realise the futility of sometimes looking for purpose and design in a
    > world in which meaning is almost always elusive but here is my question:
    > Is it normal or common this nesting of lists instead of giving them a
    > class or an id? I have never seen it before. And Why?
    >
    > Tim W


    If you have a list inside something like <div id="name">, then you can
    select the list elements via such as

    #name ul {...}

    #name li {...}

    #name li ul {...}

    #name li li {...}

    etc. The ULs and LIs inside the containing div need have no classes or
    IDs, they get selected by reference to their containing elements
    which, in turn, may or may not be classed or IDed either. On the very
    latter point, if the only DIV in the html doc had list(s) inside or if
    only one DIV had list(s), then no need even for a class or ID at all
    as far as the one doc is concerned.

    div ul {...}

    div li {...}

    div li ul {...}

    div li li {...}

    If there is only one bunch of lists in a doc, no need even to bring
    the container into it:

    ul {...}

    li {...}

    li ul {...}

    li li {...}

    --
    dorayme
     
    dorayme, Feb 5, 2013
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sara
    Replies:
    0
    Views:
    670
  2. DeadlyTedly
    Replies:
    2
    Views:
    2,551
    Ted Bradley
    Oct 16, 2003
  3. Trans
    Replies:
    10
    Views:
    308
    Sean O'Halpin
    Sep 16, 2005
  4. Tim W

    nesting instead of id ing??

    Tim W, Feb 5, 2013, in forum: HTML
    Replies:
    23
    Views:
    881
    Gus Richter
    Feb 14, 2013
  5. Tim W

    nesting instead of id ing

    Tim W, Feb 6, 2013, in forum: HTML
    Replies:
    0
    Views:
    292
    Tim W
    Feb 6, 2013
Loading...

Share This Page