Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Justin Benton
Justin Benton
4,765 Points

Random Question about Bold Text in HTML...

Just finished the HTML track and had a question RE: setting text to bold. Why is <strong></strong> preferred over <b></b> for making text bold? Has the Strong tag replaced the b (for bold) tag? Are they interchangeable or would you use one over another in certain instances? Just curious. Thx!

Jean Simmons
Jean Simmons
7,615 Points

Honestly I wouldn't use either. I would set boldness with CSS. But perhaps you are only on an HTML course at this point and haven't gotten to CSS yet? W3Schools has the unofficial official take on the <b> tag here >> http://www.w3schools.com/tags/tag_b.asp.

I would say, these <strong>, <b> tags are nice to "know" about, but in practice I don't use them much. It is much more practical to create a "bold" class in CSS and make text bold by implementing the style. I haven't taken any of the Treehouse Web Dev courses, but I've always been taught that HTML should pretty much be used SOLELY for content and ALL styling should happen in the CSS as this is easier to maintain in the long run and also easier to modify if your client changes their mind or asks for a tweak (can you make it bolder?). The big downfall to these tags in my head being that each browser interprets the final "line thickness" of each in different ways, and from Chrome to Firefox <strong> or <b> text will look different. Using CSS allows a more consistent styling.

The absolute only time I use either tag is when I want to make a single word or grouping of words within a paragraph bold since they don't have their own tag to add a CSS class too, but you could just as easily use a <span class="bold"></span> tag to achieve the same result with a more consistent look across browsers.

In either case, whatever you decide to do, as long as you are consistent in the way you implement bold text, that's all that really matters.

My 1st choice: CSS "bold" class My 2nd choice: <strong></strong> My last resort: <b></b>

1 Answer

Cindy Lea
PLUS
Cindy Lea
Courses Plus Student 6,497 Points

I did some research on this and found some different opinions. Here are two that I found intersting:

On Mozilla Developer's Network:

It is often confusing to new developers why there are so many ways to express the same thing on a rendered website. Bold and Strong are perhaps one of the most common. Why use <strong></strong> vs <b></b>? You have to type a whole lot more with strong and it produces the exact same result, right?

Perhaps not; strong is a logical state, and bold is a physical state. Logical states separate presentation from the content, and by doing so allow for it to be expressed in many different ways. Perhaps instead of rendering some text as bold you want to render it red, or a different size, or underlined, or whatever. It makes more sense to change the presentational properties of strong than it does bold. This is because bold is a physical state; there is no separation of presentation and content, and making bold do anything other than bold text would be confusing and illogical.

It is important to note that <b></b> does have other uses, when one wants to draw attention without increasing importance.

html-5-tutorial.com: They both make text bold. In terms of presentation they are identical. So why have two elements that do the same thing? They may look the same to humans, but the web crawlers or bots – that crucial second audience – see something quite different. When a search engine spiders and analyzes a page, text in <strong> tags is considered important. Text in <b> tags is not. *