Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: Formula for configuring EM for width mathematically

  1. #1
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Formula for configuring EM for width mathematically

    Is there a simple logic when using ems for the width when making a navigational css menu?

    If I wanted 8 main menu catagories, can the width be computed mathematically?

    My problem happens at the sub level width of the menu.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well, em's for dimensions are tied to the font-size in effect of the element being styled. With a default font and font-size, you can generally divide the desired pixel dimension by 16 to arrive at the em dimension. If your font and/or especially font-size is different, you need to use a different divisor but, this usually can be fairly quickly arrived at via trial and error.

    Incidentally, if you are going to set dimensions by em's and are not using the default font size, it is best to set the font-size style as a percentage. All sorts of inconsistencies can arise in IE if you use anything else. In fact, for best design results in general, font-size should always be set as a percent or not at all.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yes:
    Code:
    xem = 1em × x
    The exact size of 1em is dictated by the user's font settings.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Twey View Post
    Yes:
    Code:
    xem = 1em × x
    The exact size of 1em is dictated by the user's font settings.
    That's unhelpful from a design perspective. If you set things so that they work with the font size you have, as outlined in my previous post in this thread, you generally will arrive at a design that can adapt to the viewer's font-size. That's the whole point.

    However, the keyword is generally. There are many novice design practices that could result in a mess when the user changes font-size. The best way to tell is to experiment with the design, viewing it in the browser with different font-sizes to see the result.

    Incidentally this method of designing, using em's for dimensions is becoming less important with many browsers using a more or less true zoom in favor of text size changes. Due to a number of factors however, for the foreseeable future, em dimensions will continue to be a key accessibility feature of a well thought out design.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Not so. It will no longer be important due to explicit text resizing, but default font sizes still vary, even if the user doesn't specifically adapt them for the page.

    ems are also a good measure of what a user considers acceptable: 1em will always be a readable font size.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Twey View Post
    Not so.
    Huh? What's not so? The fact that em designing is becoming less important or the fact that for the foreseeable future it still will be important? Something else?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Back to the original post... the user wants to know how to use em's for the width of his/her menu. I suppose he/she wants to automatically calculate the width of the menu depending on the font size of the page.
    - Mike

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The fact that em designing is becoming less important or the fact that for the foreseeable future it still will be important?
    The former, sorry for being vague.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm sorry, it simply is less important. It still is important but, with most users now with the available ability to scale a page rather than its fonts, it is clearly less important, if only slightly. This trend will most likely continue though so that, at some point, it will no longer be much of a consideration at all.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The only time at which it will cease to be a serious consideration is when all users have exactly the same font size, which I must say is quite an unlikely event.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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