Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove a specific bullet point within a ul in CSS?

Tags:

css

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?

like image 780
Chris Avatar asked Apr 29 '13 19:04

Chris


People also ask

How do I get rid of bullet points in UL CSS?

Adding the "list-style: none" CSS class to the unordered list (<ul>) or ordered list (<ol>) tag removes any bullet or number.

How do you delete a point in CSS?

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.

How do I remove bullets from UL bootstrap?

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.


2 Answers

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.

like image 70
dsgriffin Avatar answered Oct 23 '22 15:10

dsgriffin


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;
}
like image 38
Kevin Lynch Avatar answered Oct 23 '22 14:10

Kevin Lynch