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?
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.
HTML <b> and <strong> Elements The HTML <b> element defines bold text, without any extra importance.
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; }
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With