Click to See Complete Forum and Search --> : How can I make a word in a paragraph bold?
alank2
12-17-2007, 02:26 PM
Hi,
How can I make a word in a paragraph bold?
Since all formatting is supposed to be in the stylesheet, do I need to create some sort of class like p.bold or something? When I try this it puts the bold word in its own paragraph. What is the right way to do this?
Thanks,
Alan
Mr Initial Man
12-17-2007, 03:10 PM
Okay, why are you making it bold? Is it simply to make it bold, or do you want to highlight it, like one would highlight an important term?
alank2
12-17-2007, 03:12 PM
Hi,
Is there a difference?
I want to format a word in bold like this using CSS.
Do people normally do this in CSS or do they do it in HTML still because it is easier?
Thanks,
Alan
Mr Initial Man
12-17-2007, 03:23 PM
There is indeed a difference. You get into something called "semantics", which is simply what each HTML element means.
Why does one use <p> to create a paragraph instead of <div>? Because <div> is basically a division. <p> denotes a paragraph. Now, if you want to make a word bold just for looks, then it would be best to use something along the lines of <span class="bold">bold</span>, as <span> simply means a span of text, nothing more, nothing less.
If you want to make the word bold to highlight it for some reason (for example, if it is a term), then using the <strong> element is perfectly acceptable.
alank2
12-17-2007, 03:27 PM
Hi,
Thank you, that is what I was looking for. Much appreciated!!
Alan
Mr Initial Man
12-17-2007, 04:41 PM
You're welcome. If you want to know if you use HTML or CSS to "format" your content, read it aloud. If you find yourself emphasizing words, it is acceptable to use HTML to mark them up. If no, then use CSS. For example, how do you speak bold words or italic words? You don't. But emphasizing words or highlighting terms when we speak is something we do all the time.
BTW, color and size should ALWAYS be done via CSS.