I have a simple list and all I want to do is remove a specific bullet point (just the icon, not the content within the li) within the ul
.
I've used first-child to take away the first but I'd like to remove the sixth bullet point!
I could so it inline but I'd prefer to do it with CSS.
How can I do this?
Adding the "list-style: none" CSS class to the unordered list (<ul>) or ordered list (<ol>) tag removes any bullet or number.
The removal of the list bullets is not a complex task using CSS. It can be easily done by setting the CSS list-style or list-style-type property to none. The list-style-type CSS property is used to set the marker (like a disc, character, or the custom counter style) of a list item element.
If you're using the Bootstrap framework you can simply apply the class . list-unstyled on the <ul> or <ol> element. It removes the bullets (or list markers) as well as the left padding from the list items which are immediate children of the <ul> or <ol> element.
jsFiddle here.
You can use the nth-child selector to achieve this.
li:nth-child(6) {
list-style-type: none;
}
Edit:
It now seems you want to hide it for the last child, you can use the last-child selector instead:
New jsFiddle here.
li:last-child {
list-style-type: none;
}
If you'd like to get either of these working in IE6-8, you could use Selectivizr.
"Selectivizr is a JavaScript utility that emulates CSS3 pseudo-classes and attribute selectors in Internet Explorer 6-8"
nth-child and last-child are some of those supported selectors in Selectivizr.
Use nth-child DEMO http://jsfiddle.net/L8VW4/
This will remove the list item
li:nth-child(6) {
display: none;
}
This will remove only the bullet icon present beside the list item and leave the list item itself in place
li:nth-child(6) {
list-style: none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With