Skip to main content
Inspiring
May 12, 2018 2:17 PM UTC
Answered

Why in CSS with an "italic" class the text becomes smaller?

In a html-file I have paragraphs with text. I have a CSS-file, with some classes.I have set up "p" with:

p {   

   font-family:Verdana, sans-serif;

    font-size:0.833em; /* and so on*/

}

.italic {

    font-family:Verdana, sans-serif;

    font-size:0.833em;

    font-style:italic;

    font-weight:normal;

}

.rientro {

    margin-bottom:4px;

}

I have: <p class="rientro"><span class="italic">text,text</span></p>, the text is malles then the "normal" text, without italic, why?

    This topic is closed to new replies. Start a new post to keep the conversation going.
    ALsp
    ALspCorrect answer
    Legend
    May 12, 2018 2:23 PM UTC

    Because ems is a proportional measure. So...

    Based on your rules, elements assigned the italic class will have text 83% as big as their parent paragraph does. If you want italic to be the same size as the rest of the text, leave the font-size off.

    Font-size, by the way, need only be set on a single element, usually the body, with the need to further declare based on exceptions to the body rule.

    3 replies

    ALsp
    ALspCorrect answer
    Legend
    May 12, 2018 2:23 PM UTC

    Because ems is a proportional measure. So...

    Based on your rules, elements assigned the italic class will have text 83% as big as their parent paragraph does. If you want italic to be the same size as the rest of the text, leave the font-size off.

    Font-size, by the way, need only be set on a single element, usually the body, with the need to further declare based on exceptions to the body rule.

    Translate
    pfudiAuthor
    Inspiring
    May 12, 2018 3:54 PM UTC

    First thank you very much for replay! It is realy helpfull!!

    I will look for to remove al font-size, because I have bold and so on in the CSS.

    Now the text have the same size like the text, it's wonderfull!!!

    Thank zou so much

    Have a nice Sunday

    Translate
    pfudiAuthor
    Inspiring
    May 12, 2018 4:00 PM UTC

    It works on Dreamweaver very well, but on Sigil (for epub) it don't works, why?

    Translate