Forum Moderators: not2easy

Message Too Old, No Replies

CSS bold styling within a line

         

Tonearm

4:44 am on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How can I style a certain word in the middle of a line of text as bold with CSS? When I use div around the word I get a line break.

- Grant

Rambo Tribble

4:51 am on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use a span with a class rule that gives it font-weight of bold.

photon

12:56 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To expand on Rambo Tribble's answer, <div>s are block level elements, and <span>s are inline elements.

DrDoc

3:13 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use <strong> instead.

Tonearm

5:08 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Dr. Doc -

Does that give it a higher relevance with a search engine? What if I don't want the bold word competing with my targets words for relevance?

Tonearm

6:39 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How would you guys describe the difference between a block level element and an inline element?

photon

6:50 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's the official W3C explanation [w3.org], and here's a more user-friendly one [webmasterworld.com] in message #30.

Briank58

7:03 pm on Apr 12, 2004 (gmt 0)

10+ Year Member



In the simplest terms:
block level elements add line spaces before and after the tag
inline elements don't

DrDoc

7:28 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<strong> makes no difference as far as search engine ranking. However, it provides the proper markup for a word you want to assign extra emphasis to. ...especially if a visitor is using a screen reader.

There is no need to replace <strong> or <em> with CSS if they describe what you want to do anyway. However, if the bold text is only meant as a visual effect then, yes, you should use CSS.

Tonearm

11:09 pm on Apr 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks alot guys. That clears things up a lot.