Skip to content Skip to sidebar Skip to footer

How To Restyle Em Tag To Be Bold Instead Of Italic

I want to make the text within an tag bold instead of italic. Is there a way to achieve this with CSS?

Solution 1:

Sure, use following CSS code:

em {
   font-weight: bold;
   font-style: normal;
}

Solution 2:

You can add the following to your css

em { font-style: normal; font-weight: bold; }

you could also create a class to be used on specific em tags

CSS: .non-italic{ font-style: normal; font-weight: bold; }
HTML: <em class="non-italic"></em>

or you can change a specific em tag (not good practice)

<emstyle="font-style:normal; font-weight:bold;"></em>

Solution 3:

Set font-style to normal to force the <em> to always be non-ital or inherit to inherit the setting from the parent (demo):

<divclass="normal"><h1><code>font-style:normal;</code><small>- Always non-ital</small></h1><p>Should not be ital: <em>Foo</em></p><pclass="ital">Should be ital: <em>Foo</em></p></div><divclass="inherit"><h1><code>font-style:inherit;</code><small>- Inherits from parent</small></h1><p>Should not be ital: <em>Foo</em></p><pclass="ital">Should be ital: <em>Foo</em></p></div>
.normalem {
    font-weight:bold;
    font-style:normal;
}
.inheritem {
    font-weight:bold;
    font-style:inherit;
}
.ital {
    font-style:italic;
}

Post a Comment for "How To Restyle Em Tag To Be Bold Instead Of Italic"