# Bold and Italics in CSS



## rabidjade

I am still learning CSS but have a concept of it for the moment. I needed to add bold and italics to my text so I added <b> and <i> tags and gave them each their own entry in the css style sheet file:



> b {
> font-style:bold;
> }


Doing this also made me fail the css certification too. My css file is here. To make a word bold, I currently have it like this: <p><b>bold text</b></p>. So what am I doing wrong here and how do I make it more proper. I read that <strong> and <em> tags were on the way out but have been told otherwise recently. Look at the first page on my site and you can see where I use both currently.


----------



## KoosHopeloos

@ rabidjade: as far as I know you have to use the tag <strong></strong> and <em></em> to create thicker/italicased text. It is similar to <p>:

for example: strong {font-size: 135%}

I use it on my website and validates without any problem.


----------



## gamerman0203

CSS (common):

p {font-weight:bold} will make anything inside a <p> tag *bold*
p {font-style:italic} will make anything inside a <p> tag _italic_
p {font-style:italic;font-weight:bold} will make anything inside a <p> tag _*bold and italic*_

.class1 {font-style:italic;font-weight:bold} will make anything with the class designation of "class1" bold and italic. example: <p class="class1">Hello!</p>. _*"Hello!" will be bold and italic.*_


----------



## KoosHopeloos

@ rabidjade: Forget my comment! I'm not sure what I was babbling about, since I use the exact same code as gamerman0203 suggests on my own website.


----------



## kmm2908

rabidjade said:


> I am still learning CSS but have a concept of it for the moment. I needed to add bold and italics to my text so I added <b> and <i> tags and gave them each their own entry in the css style sheet file:
> 
> 
> 
> Doing this also made me fail the css certification too. My css file is here. To make a word bold, I currently have it like this: <p><b>bold text</b></p>. So what am I doing wrong here and how do I make it more proper. I read that <strong> and <em> tags were on the way out but have been told otherwise recently. Look at the first page on my site and you can see where I use both currently.


Hi there

Doing it this way you are missing the major point of using css, separating display code and formatting i.e. getting rid of font display tags.

If you use a class to set the bold and any other attributes to the text you have it cracked.

.boldText{font-weight: bold;}

<p> This is normal text</p>

<p class="boldText"> This is BOLD text</p>

Hey I bet you got your css certification now! :grin:


----------

