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


Tags: html,css

Problem :

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?



Solution :

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.


    CSS Howto..

    How do I Add border to text in inputfield

    How to put two divs on the same line with CSS in simple_form in rails?

    How To Get Circle Image Between
    Tag Like Tumblr In HTML? [closed]

    How to shrink the width size hyperlink?

    How do I show a handle to indicate to the user that a panel is resizable?

    How to dynamicaly change css style?

    How to make text wrap when resizing in a inline div, without the div moving onto a new line first?

    How to make a hyperlink navigation bar active in CSS or javascript?

    How to give menu sub menu options

    How to add this element in jquery

    How to add shadow 'wings' to a centered content div

    How to override default css style rule of Bootstrap

    How to have a different “placeholder style” and at the same time a different “text-input style” in Rails with CSS?

    How to rotate and translate using CSS in IE8?

    How can I stay organized when writing CSS? [duplicate]

    Overlay image to show like panorama [closed]

    How to change the background color of a line of user input in a textarea?

    How to select text within li using css [duplicate]

    How to identify unused css definitions [closed]

    How to add lines to
  • elemtents
  • How to style CSS role

    How do I hide the li's that don't fit on a single line?

    How can I use JQ to pick out a parent whose child is hr.strong?

    How to get every line of text / elements of a page centered horizontally?

    How to position a label using css relative to an absolute positioned input box

    How to change the position of the JQuery dialog box

    How to reveal content behind a div with pure css?

    How can i setup multiple sites within a single ASP.Net project?

    How do I place text to the right of a relatively positioned image?

    How to prevent page margin from expanding in HTML/CSS code when window is resized