How to style parent li elements of headers using CSS?


Tags: html,css,html-lists,html-heading

Problem :

I would like to be able to set the property list-style-type: none; on all li elements that contain a major header (<h1>, <h2> and <h3>).

At first I tried this -

li h1,
li h2,
li h3 {
    list-style-type: none;
}

But then I realised it wouldn't work, because it is setting the property on the headers, not the list elements.

How can I do this?



Solution :

You can assign a class to li items which contains header elements and set list-style to none.

For Example:

li.header {list-style:none;}

    CSS Howto..

    I am having a hard time figuring out how to dynamically setup a timeline

    How to pull out CSS attributes from inline styles with BeautifulSoup

    How can I apply a style to element if the user came to website using a link with an anchor/hash [closed]

    How do you refer to more than one .css file in html?

    How to apply pseudo-element styling to specific class only?

    How to make text appear under div without moving other items in list?

    How to set the css property of dynamic data

    How to correctly display HTML page in browser and mobile

    How to style child components from parent component's css file?

    How to add a style only to certain elements of a list via CSS

    How to add space using css?

    How do I make the text in the next line to be centered and not aligned to the left?

    How do I output HTML form data to PDF?

    How to achieve Expand collapse Side Nav with icon using jquery and boostrap css

    How to apply only one css file out of two css files included?

    How to write this css in shorter way? see example

    How can I reduce the space between two elements in CSS?

    I have a CSS file in my App_Themes folder - how can I apply it to my web user control?

    Compass delimited list separator - how to set to – [duplicate]

    Rollover table shows hidden span class text with css

    CSS Sprites - How to leave Hover button in depressed state

    CSS selector problem. Any ideas how to select this?

    How to add a sliding div to these CSS Message Bubbles?

    How to persist checking the screen width in Javascript

    How to pass css :active pseudo class to javascript?

    toggleClass on the same container and show different content with tabs effect

    How to replace a text-align: -webkit-center?

    How to set min-height for bootstrap container

    How to create a cross with pure css [duplicate]

    How can I add my own CSS styles to CKEditor