Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Specific use of ul

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #34505
    cayoub88
    Member

    Hi there,

    I have a question regarding a specific use of the UL tag.

    If you had something like this on a page:

    Screenshot

    Would you use an unordered list that houses a div tag inside the li?



















    Or would you just use div tags on their own?











    What’s more semantic? I have no problem styling either way, but It’s just one thing that’s been playing on my mind. Practically there’s no real use for the ul here, but at the same time it is a list of things being displayed right?

    So far i’ve always been using the first method, but I want to make sure i do it all 100% right..

    Thanks

    #87926
    chrisburton
    Participant

    @cayoub88 – You wouldn’t need the div on the first markup.

    #87933
    ketu
    Member

    Hey,

    You couldn’t use the div tag inside li tag, if you use then it will give error in W3C validation.

    So make one class for that and use img,h2 and p tag for that, so your structure becomes follows,




    Weddings


    Lorem ipsum...Read More






    One Man Shows


    Lorem ipsum...Read More






    Entertainment Nights


    Lorem ipsum...Read More



    Let it try :)

    #87935
    cayoub88
    Member

    Thanks for your comments guys. I didn’t realise I could use the first markup without the div (although it does validate @ketu).
    So should i not use a ul tag? I’m just after what’s more semantic…

    #87938
    chrisburton
    Participant

    @ketu – with HTML5 you can have a div inside a list item.


    @cayoub88
    – I think I would go with the div option.

    #87941
    cayoub88
    Member

    Done deal. Thank you guys.

    #88009
    cayoub88
    Member

    Makes sense, thanks for the addition @wolfcry911 , I think it is a tough call but realistically both should work in a given situation. I’ve used the ul li div format on this page arabiansounds.com.au/prod.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘CSS’ is closed to new topics and replies.