Forums

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

Home Forums CSS [Solved] Style heading tag within ul li

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30040
    marc
    Member

    Hi.

    I am trying to target h4 tags within a ul li. I want the list items to have a bullet point but I want the h4 tag li’s to have no list styling. I have tried this css but the list styling still appears on the li’s with a h4 tag inside. Am I missing something here?

    HTML



    List title



    • list section title


    • list item

    • list section title


    • list item



    CSS


    .fullsizewrapper h4 {
    list-style-type: none;
    }

    Many thanks.

    #81368
    marc
    Member

    Many thanks betzster. I used your second suggestion, to avoid having lots of lists and it worked perfectly. I didn’t think about putting non li elements within a ul. Cheers.

    #81370
    noahgelman
    Participant

    But putting an h4 tag inside a ul without being in a list item doesn’t validate. You can put a class on the list item with the h4 in it and target it that way. You can also put in an if else statement with php or use javascript although those last 2 aren’t very semantic. I’d probably just go with a class unless not validating properly isn’t a concern for you.

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