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 5 of 5
  1. #1
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Font size - em, px or %

    Whats the best rule to use when deciding font size? I have always used pixels but today a friend said use %?

    another reason i am asking is because i anxious to find out what happens if someone enlarges my text and the div around the text can't show it as it is not big enough - is there a work around for this (aside from making a larger div?), e.g can i make a auto size div?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I've found the best solution for things like this is to use em for widths and/or heights. If the text is resized the element will also resize accordingly. A good example is this site
    http://www.klproductions.com/
    It belongs to vladdy on the forums. Resize the text and notice how everything resizes according to the text size.

    If you use px or pt IE users won't be able to resize their text but any other browser will be able to.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts
    thanks aero, so your saying use em's for the divs and text?

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Yes thats what I'm saying. If its okay for text to go to more than one line then just be sure not to set a height on the element.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    Regular Coder KevinG's Avatar
    Join Date
    Aug 2002
    Location
    The Matrix
    Posts
    405
    Thanks
    3
    Thanked 0 Times in 0 Posts
    thanks as usual aero, i'm off to 'em' everything.


  •  

    Posting Permissions

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