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 HTML Forms HTML Mastery

Christoffer Johansen
Christoffer Johansen
4,342 Points

Add Bold paragraph...

I've tried everything, just want to get it completed. Asks me to add a bold paragraph within the <div> ... tried <b> // <p><b> // etc....

1 Answer

Erik McClintock
Erik McClintock
45,783 Points

Christoffer,

You can make text in a paragraph bold by surrounding it with the strong tag, as follows:

<strong><p>This text will be bold</p></strong>
<p>This text will not be bold</p>

Alternatively, you can make text bold by tweaking its font-weight property in your css:

p {
font-weight: bold;
}

Hope this helps!

Erik

Erik McClintock
Erik McClintock
45,783 Points

Naturally, then, if you only want some words in your paragraph to be bold, you can put the strong tag around that word/those words only:

<p>This <strong>word</strong> is bold</p>
Grant Zabriskie
Grant Zabriskie
11,017 Points

Christoffer and Erik,

According to my understanding, you are mostly right, but strong tags should always in inside paragraph tags. The paragraph tag is block level element and the strong tag is inline level. Inline level tags should never contain block level tags. There is one exception in that anchor tags (which are, by default, inline level) can surround other block level elements. So, in your first example, it should be:

<p><strong>This text will be bold</strong></p>

Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elemente

Erik McClintock
Erik McClintock
45,783 Points

My mistake! Thanks for catching and making note of that, Grant.

Erik