How can I disable a specific LI element inside a UL? [closed]

If you still want to show the item but make it not clickable and look disabled with CSS: CSS: .disabled { pointer-events:none; //This makes it not clickable opacity:0.6; //This grays it out to look disabled } HTML: <li class=”disabled”>Disabled List Item</li> Also, if you are using BootStrap, they already have a class called disabled for … Read more

How do I get the bullets of an unordered list to center with the text?

Add list-style-position: inside to the ul element. (example) The default value for the list-style-position property is outside. ul { text-align: center; list-style-position: inside; } <ul> <li>one</li> <li>two</li> <li>three</li> </ul> Another option (which yields slightly different results) would be to center the entire ul element: .parent { text-align: center; } .parent > ul { display: inline-block; … Read more

Stretch horizontal ul to fit width of div

This is the easiest way to do it: http://jsfiddle.net/thirtydot/jwJBd/ (or with table-layout: fixed for even width distribution: http://jsfiddle.net/thirtydot/jwJBd/59/) This won’t work in IE7. #horizontal-style { display: table; width: 100%; /*table-layout: fixed;*/ } #horizontal-style li { display: table-cell; } #horizontal-style a { display: block; border: 1px solid red; text-align: center; margin: 0 5px; background: #999; } … Read more

How to remove all li elements inside an ul except the first and the last elements using jQuery?

To remove from all ul-s on the page the li-s that are neither the first nor the last: $(‘ul li:not(:first-child):not(:last-child)’).remove(); Or using a specific id: $(‘#yourul li:not(:first-child):not(:last-child)’).remove(); If you have a jQuery object with your ul in it: $(yourul).find(‘li:not(:first-child):not(:last-child)’).remove();

tech