HTML + CSS: Ordered List without the Period?

This is perfectly possible to do with just CSS (2.1): ol.custom { list-style-type: none; margin-left: 0; } ol.custom > li { counter-increment: customlistcounter; } ol.custom > li:before { content: counter(customlistcounter) ” “; font-weight: bold; float: left; width: 3em; } ol.custom:first-child { counter-reset: customlistcounter; } Keep in mind that this solution relies on the :before pseudo-selector, … Read more

with numbers another color

The CSS spec gives an example of doing just this. Unfortunately, while it works on Firefox 3, it doesn’t appear to work on IE7: <html> <head> <style> ol { counter-reset: item; } ol li { display: block; } ol li:before { content: counter(item) “. “; counter-increment: item; color: red; } </style> </head> <body> <ol> <li>item</li> … Read more

How to check if a list is ordered?

If you are using MSTest, you may want to take a look at CollectionAssert.AreEqual. Enumerable.SequenceEqual may be another useful API to use in an assertion. In both cases you should prepare a list that holds the expected list in the expected order, and then compare that list to the result. Here’s an example: var studyFeeds … Read more

how do I get the bullet points of a 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

Changing CSS for last

:last-child is really the only way to do it without modifying the HTML – but assuming you can do that, the main option is just to give it a class=”last-item”, then do: li.last-item { /* … */ } Obviously, you can automate this in the dynamic page generation language of your choice. Also, there is … Read more

tech