Skip to content
← Back to Community
What is the piece of code to bold a piece of text? (HTML)
Profile icon
croakley

I'm working on a project but I cannot bold a piece of text. Can I have some help?

Answered by Geocube101 [earned 5 cycles]
View Answer
Voters
Profile icon
Zekarias3
Profile icon
croakley
Comments
hotnewtop
Profile icon
Geocube101

You can use the font-weight property to bold text

<element style="font-weight: bold;">innerHTML</element>

...or if you're using the "style.css" page or <style> tag...

element { font-weight: bold; }

In both cases, replace "element" with the actual element you're using

Profile icon
Vandesm14

Use the <b> tag to bold sections of text:

<b>this is bold</b> <br> this is not bold
Profile icon
[deleted]

@Vandesm14 Or the strong tag. I think it is the preferred tag to use these days as it is more semantic: <strong>I am bold and strong!</strong>.