Click here to Skip to main content
15,887,596 members
Articles / Web Development
Article

Changing the color of HTML un ordered list.

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
11 Oct 2013CPOL 63.7K   1  
It's a hot topic among web developers that is it possible to change the color of HTML bulletin list? Well, as many says, it's impossible, there is

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

It's a hot topic among web developers that is it possible to change the color of HTML bulletin list? Well, as many says, it's impossible, there is a very simple way to deal with it. Following is the full code to change the size and change the color.

<ul style="font-size:20px">
<li style="color:Red" ><span style="color:Black; font-size:12px">1</span></li>
</ul>

Let's see one by one what exactly the code do.

 <ul style="font-size:20px">

By setting the font-size for the whole list you can change the size of the bullet. It applies for both text and the bullet. So later, we have to include the text within a span tag and define the style for the text itself.

 <li style="color:Red" >

By setting the color, you can specify what color the bullet should take.

 <span style="color:Black; font-size:12px">

Since the color and font-size applies for the text also, you need to include the text within span tags to separate it from the bullets so you can specify a separate style for the text. 

I tested it with latest FF, IE and Chrome web browsers and it works like a charm!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.

The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
This is a Collaborative Group

754 members

Comments and Discussions

 
-- There are no messages in this forum --