tukaef
tukaef

Reputation: 9214

How to specify font-size for all bold text in the div?

I have the div, containig some html-formatted text like normal, <b>bold</b>, <i>italic</i>. And I need to change font-size for all bold text only in that div.

So the question is how to do this in html/css, or maybe js?

Upvotes: 1

Views: 4838

Answers (3)

Pranav
Pranav

Reputation: 8871

you can use element selector as :

#divId b
{
font-size:1.1em;
//what ever you want also  
} 

Upvotes: 1

NedStarkOfWinterfell
NedStarkOfWinterfell

Reputation: 5153

div#divid b { font-size: 18px; }

Upvotes: 2

Peter
Peter

Reputation: 16923

div.foo b, div.foo strong {
  font-size: 1.2em
}

if you are using inline style like <i style="font-weight:bold"> case is more complicated.

Then you have to use jQuery+CSS

$('div.foo *[style=font-weight:bold]').addClass('myFontSize');

div.foo .myFontSize {
  font-size: 1.2em;
}

But please mind it's not good practice.

Upvotes: 8

Related Questions