I have a navigation menu, footer, and a slideshow which use listed style to list links and images. I have the css list-style:none;
set to hide the bullets next to the links and images in the nav and footer but I want to show the bullets for list normal text.
How can I do this?
I combined some of Flavio's answer to this small solution.
The decision about bullets is made at an enclosing element, typically a
div
. The drawback (or todo) of my solution is that the liststyle removal also applies to ordered lists.The example bellow explains how to remove bullets using a css style class. You can use , similar to css class, by identifier (#id), by parent tag, etc. The same way you can use to define a css to remove bullets from the page footer.
I've used this site as a starting point.
Let's say you're using this HTML5 layout:
You could say in your CSS:
If you're using HTML 4, assign IDs to your DIVs (instead of using the new fancy-pants elements) and change this to:
If you're using a CSS reset stylesheet (like Eric Meyer's), you would actually have to give the list style back, since the reset removes the list style from all lists.
You can also define a class for the bullets you want to show, so in the CSS:
And in the HTML you just define which lists to show:
Or you alternatively define a CSS class:
Then apply it to the list you want to show:
All other lists won't show the bullets...
You can style
li
elements differently based on theirclass
, theirid
or their ancestor elements:Or, to use the ancestor elements:
You need to define a class for the bullets you want to hide. For examples
Then apply it to the list you want hidden bullets:
All other lists (without a specific class) will show the bulltets as usual.