Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
Like Tree2Likes
  • 1 Post By mlseim
  • 1 Post By mlseim

Thread: How to Change <em> (Italics) Font Size in CSS

  1. #1
    Junior Member
    Join Date
    Sep 2021
    Posts
    4
    Member #
    63025

    How to Change <em> (Italics) Font Size in CSS

    I am using an old desktop version of Dreamweaver that applies <em> for italics via the graphical, or "design", interface. I would rather use this than code every instance. How can I style <em> in CSS so it is a different percentage size than the paragraph text?

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,973
    Member #
    5580
    Liked
    760 times
    See this:

    https://www.w3schools.com/tags/tag_em.asp


    em { font-size: 1.1em }

    What might confuse people ... the <em> tag = emphasized text.

    "em" in the use of size affects the font size. em is the current font size (1.0em) and then enlarged from that (1.1em), therefore it becomes scalable in size.

    Alternately you can force an absolute size by pixel (20px) or point (12pt)
    Last edited by mlseim; Sep 23rd, 2021 at 07:33 AM.
    wdfsolutions likes this.


  4. #3
    Junior Member
    Join Date
    Sep 2021
    Posts
    4
    Member #
    63025
    Thank you. That works well, and I found that it is also possible to use a percentage to set the italics size.

  5. #4
    Junior Member
    Join Date
    Sep 2021
    Posts
    4
    Member #
    63025
    The size issue described in my OP was solved, but now I am finding text-align:center; is not working on <em>. It is not within <p> styling.

    Can anyone please advise why this might be happening? I have tried everything I can think of, even testing the italics on a clean page.

  6. #5
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,973
    Member #
    5580
    Liked
    760 times
    Text can’t center unless it knows the width of the <div> that it is supposed to center within. Try doing <p style=“width:100%; text-align:center;”> or specify the width of a <div> if you are using <div>
    wdfsolutions likes this.

  7. #6
    Junior Member
    Join Date
    Sep 2021
    Posts
    4
    Member #
    63025
    OK. That all makes sense now.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Tags for this Thread

All times are GMT -6. The time now is 03:47 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com