Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing Font Size in Browser

    Hi

    I want the user to be able to change the size of the font in their browser

    eg.. IE --- View -- Text Size -- Largest, Larger etc

    Do you use the em tag?

    I am using a stylesheet so does this go within the stylesheet code?

    Any help greatly appreciated.
    Many Thanks
    GG.

    ---------------------------------------------------------

    <style>
    body {
    background-color: #FFFFFF;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px 2em ;
    line-height: 24px;
    color: none;
    }
    <style>

  • #2
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yea you need to change those font sizes from pixels to either em's, pt's, or 'small', 'smaller', 'large' etc. It is recommended you use em's though.

    As you can probably guess, a pixel is a fixed size, so IE doesn't change the font size when you change it in your browser if you use px's. Other browsers do though.

  • #3
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Firstly, it's em unit. There is an em tag (element) in markup, but that's something different.

    If you wish your text to be resizable in all browsers (incl. IE/Win) via the browser controls, then steer clear of using px or pt units.
    Fwiw, IE/Win is the only browser which fails to meet that part of the UA development guideline on resizable text. It's not yet clear whether IE7 will finally get that issue sorted and finally achieve something other browsers (incl. IE/Mac) have been capable of for years.
    I certainly hope it does, as I'm personally fond of using px units for font sizes - you know where you are with pixels - and I'm tired of having accessibility devotees and other 'realists' (read: IE-apologists) frowning at authors like it's their fault that IE/Win users can't resize text because it's set in px units.

    Anyhoooo…


    Incidentally, …
    Code:
    font-size: 12px 2em ;
    That's nonsense.
    The font-size property can accept only a single value.
    Last edited by Bill Posters; 12-12-2005 at 05:44 PM.

  • #4
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oops yup, forgot pt is fixed in IE too.

    Change that CSS part to this, and all should be fine -

    body {
    background: #FFF;
    font: 1em/2em Verdana, Arial, Helvetica, sans-serif;
    }


    (I like shortening things ).

    I don't see why you set color to none so I left that out, and you'll have to play with the sizes to make them look as how they did before.

    When you set all the propeties for font in one declaration the line height can be included as I did above (fontsize(1em)/lineheight(2em)).


  •  

    Posting Permissions

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