07 July 2009

How to use CSS font-weight

Font-weight is what makes text bold. Firstly, let's make it clear that's it's easier to style the elements in the external stylesheet than to do the styling inline. You can use 'b' tag to make elements bold by wrapping it around the text, although it's recommended now to rather use 'strong' tags instead. I don't use any of those two.

Let's quickly look at the standard options. There's normal, bold, bolder, lighter and then values from 100 to 900. Here's an image with those values set:

font-weight values displayed

As you can see, I clearly don't understand what you'll use bolder and lighter for. For that matter, since only normal and bold is left, I also don't understand what the values are worth, since from 600 it's bold and before that it's normal.

I make a class

.bold {font-weight:bold}

in my css file and just add that class to words or tags that I want to make bold. Works best for me.

Take care! Tjorriemorrie

No comments:

Post a Comment