Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the colour of a list? 2

Status
Not open for further replies.

funkymonk

Technical User
Dec 18, 2000
588
GB
Hi,

How can I change the colour of the bullets in an UnOrdered list?

Also while we're at it, how can I change the bullet to another shape/symbol/image? Can this be done?

Thanks

funkyteks3.jpg


rod@sameplanet.co.uk
********************
 
Hi mate,

The following uses squares instead..

<ul type=square>
<li> One
<li> Two
<li> Three
</ul>


The following uses an image that you specify..

<dl>
<dt><dd><img src=&quot;bullet.gif&quot;> One
<dt><dd><img src=&quot;bullet.gif&quot;> Two
<dt><dd><img src=&quot;bullet.gif&quot;> Three
<dt><dd><img src=&quot;bullet.gif&quot;> Four
</dl>


Hope this helps Wullie

 
Indeed it can Rod, with just a bit of CSS


list-style-type: disk | circle | square | decimal | lower-roman | upper-roman | lower-alpha | upper-alpha | none

list-style-image: URL(sumthin.gif)

I presume also:

list-style-color: #??????

É
<!--#include file=&quot;profound quotation&quot; -->
 
Wullie

Excellent! The image one was perfect.

Cian

?????? My coding has gone walkabout over the last year. Where/how do I use this?
funkyteks3.jpg


rod@sameplanet.co.uk
********************
 
Hi funkymonk,

sorry I gave an inaccurate and incomplete answer, I just checked it and the colour code I gave you was bull!

Between the <head> tags of your document you can put for example:

<style type=&quot;text/css&quot;>
<!--
ul { color: #ffccff;
list-style-type: square; (or)
list-style-image: URL(sumthin.gif)
}
-->
</style>

to have different types of lists on the same page:

ul.list1 {list-style-image: URL(sumthin.gif)}
ul.list2 {list-style-image: URL(sumthin.gif)}
or
ol.list1 etc etc


In your HTML then

<ul class=&quot;list1&quot;>
<li> etc

or <ul class=&quot;list2&quot;>
<li> etc


Sorry i'm a bit rushed today so i'm not explaining it very well.
You should check out the W3C pages, they explain it very well.



É
<!--#include file=&quot;profound quotation&quot; -->
 
Excellent, thanks cian! I started getting into css & classes a while ago and then just stopped. Maybe time to start again.

Thanks to both of you for such quick responses.

Regards...
funkyteks3.jpg


rod@sameplanet.co.uk
********************
 
U should start again, its fun stuff, i reckon anyway!


É
<!--#include file=&quot;profound quotation&quot; -->
 
Yeah, I remember enjoying it when I started.

Fisrt looked at classes and went urgh? Looked again and went ahhhh!

Looks pretty straight forward, not like JavaScript. Tried that once, not sure if I'm going back. heheheh...
funkyteks3.jpg


rod@sameplanet.co.uk
********************
 
Hi Cian, funkymonk,

Setting the ul-color or li-color in the style sheet not only make the bullit in color, but also makes the complete text in the <LI>-line the same color.

Use this workaround to make only the bullit colored and the text black (or another color):

In your HTML then

<ul class=&quot;list1&quot;>
<li><font color=&quot;black&quot;>your text</font></li> etc

or <ul class=&quot;list2&quot;>
<li><font color=&quot;red&quot;>text LI-line</font></li> etc

-----------------------------------------------------

just another trick with CSS:
You can indent some <LI>-line's with:

li.line1 {left:27px; position:relative;}

and then in the HTML

<li class= &quot;line1&quot;>

-----------------------------------------------------

Hope this helps,
Erik


<!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Thanks Erik, I already have my inline (think thats what their called) set to <font face and color etc.>

Thanks for pointing it out though.

Indent could come in handy....
funkyteks3.jpg


rod@sameplanet.co.uk
********************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top