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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<OL> and list-style-type 2

Status
Not open for further replies.

JavaStripped

Programmer
Dec 18, 2002
84
CA
Is there a way to style the OL LI marker (the 1, A, etc.) independently of the LI text/contents? I'd like to be able to put the marker in bold, but not the actual text inside the LI tag. Different colors would be cool, too, but I'm not greedy...
;-)

Thanks.

JavaStripped
"I did *not* escape. They gave me a day pass."
 
Unfortunately not. Unless of course you used the
Code:
list-style-image:url(mymarker.gif)
attribute and made say 26 little letter gifs and assigned them programatically using JavaScript.
 
Fortunately YES !!!

<ol type=&quot;i&quot;>
<li>LI marker = standard black ---- LI content = standard black</li>
<li><font color=&quot;lightgrey&quot;>LI marker = standard black ---- LI content = specific color (lightgrey) by adding font-tags</li>
<li style=&quot;color:red&quot;><font color=&quot;black&quot;>LI marker = specific color (red) ---- LI content = &quot;FAKE standard&quot; black by adding font-tags</font></li>
<li style=&quot;color:red&quot;>LI marker = specific color (red) ---- LI content = specific color (red) because it's without the font-tags</li>
<li style=&quot;color:lightgreen&quot;><font color=&quot;brown&quot;>LI marker = specific color (lightgreen) ---- LI content = specific another color (brown)</font></li>
<li style=&quot;color:red;><font style=&quot;color:eek:range; font-weight:400&quot;>LI marker = normal weight + specific color (red) ---- LI content = normal weight + specific color (orange) by adding font-tags with &quot;normal font-weight style&quot;</font></li>
<li style=&quot;color:red; font-weight:700&quot;><font style=&quot;color:eek:range; font-weight:400&quot;>LI marker = half bold + specific color (red) ---- LI content = normal weight + specific color (orange) by adding font-tags with &quot;normal font-weight style&quot;</font></li>
<li style=&quot;color:red; font-weight:900&quot;><font style=&quot;color:eek:range; font-weight:400&quot;>LI marker = extra bold + specific color (red) ---- LI content = normal weight + specific color (orange) by adding font-tags with &quot;normal font-weight style&quot;</font></li>
<li style=&quot;padding-top: 25px;&quot;>here an example with a padding</li>
<li style=&quot;margin-left:-20px;&quot;>here an example with a negative margin (text indent)</li>
<li style=&quot;left:50px; position:relative;&quot;>here an example with a positive margin (text indent)</li>
</ol>

If you have a list where you want to change more then one LI markers the same color etc, then start with a style in <ol> :

<ol type=&quot;i&quot; style=&quot;color:red; font-weight:900&quot;>


Hope this helps,
Erik

<-- My sport: Boomerang throwing !!
!! Many Happy Returns !! -->
 
Cool! Thanks, Boomerang! U get a star! Dwarfthrower's idea was cool, too, but graphic design isn't my thing... and the script should be faster to implement than having to detail 52 li'l GIFs (if you're going to the trouble, you might as well have upper-case and lower-case, after all).

What the heck... Dwarfthrower's been a lot of help recently, so I'm giving his post here a star too.

[2thumbsup]

Thanks, guys!


JavaStripped
&quot;I did *not* escape. They gave me a day pass.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top