Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make ABC Ordered List Items Have Bold Style

I have an html Ordered list with type set to "A"

<ol type="A">...</ol> 

Thus, each list item will start with A, B, C, etc.

I would like to style the A, B, C letters to be bold. I have tried setting font-weight:bold; via css, but it didn't work. Any suggestions on how to do this?

like image 630
Yaakov Ellis Avatar asked May 14 '09 11:05

Yaakov Ellis


People also ask

How do you bold something in a list?

Element <b> transforms regular text to bold in HTML without adding special importance to it. This element to make HTML bold content does not emphasize the text. In order to highlight important parts of the content, use <strong> element.

How do you make text bold in HTML list?

HTML <b> and <strong> Elements The HTML <b> element defines bold text, without any extra importance.


2 Answers

a bit of a cheat, but it works:

HTML:

<ol type="A" style="font-weight: bold;">   <li><span>Text</span></li>   <li><span>More text</span></li> </ol> 

CSS:

li span { font-weight: normal; } 
like image 84
peirix Avatar answered Sep 21 '22 03:09

peirix


As an alternative and superior solution, you could use a custom counter in a before element. It involves no extra HTML markup. A CSS reset should be used alongside it, or at least styling removed from the ol element (list-style-type: none, reset margin), otherwise the element will have two counters.

<ol>     <li>First line</li>     <li>Second line</li> </ol> 

CSS:

ol {     counter-reset: my-badass-counter; } ol li:before {     content: counter(my-badass-counter, upper-alpha);     counter-increment: my-badass-counter;     margin-right: 5px;     font-weight: bold; } 

An example: http://jsfiddle.net/xpAMU/1/

like image 43
Speed Avatar answered Sep 20 '22 03:09

Speed