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
    Join Date
    Jun 2002
    Location
    Iowa / Notre Dame
    Posts
    538
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Limits of percentage based width's

    Hey,

    So, I have been experimenting a bit with designating percentage based width's through css (i.e. width: 85%), and was wondering just how specific I can get and still be within the "law" if you will. I have tried odd-ball percentages like 97.3% and they have worked in all the browsers I have on my comp: IE 6.0.2, Pheonix 0.4, Mozilla 1.2a, and Netscape 6.2.3. Is it okay to use percentages with decimal places like that? It seems wierd, but in the end, it works!
    My Site {Mike's Adventures}

    Yikes, forums are almost too much fun.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well... seeming as you cant do half pixels i imagine it wouldnt work with fixed widths... although with percentages, because nobody really has screen resolutions of < 100x* in thoery it probably shouldnt be a problem... but... i'd never decimal places in percentage of width, i'd stick with intergers
    redhead

  • #3
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Ultimately, I think browsers are obligated to support 3 decimal places (maybe this is only in SVG however).

    http://www.w3.org/TR/CSS2/syndata.html#percentage-units

    Which ultimately says that a percentage can start (optionally) with a "+" or "-", followed by a rational number (any integer, or a number with an arbitrary amount of decimal places), and followed by a "%".

    So yeah, decimal percentages are fine.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Iowa / Notre Dame
    Posts
    538
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey,

    Thanks much for the replies. I had thought about the fact that you can't do half-pixels but if you think about it, if a person's screen is 1000px in length (I know it's not a real resolution, but it's easy to work with), 97.3% would be 973px. Thus it doesn't imploy any half-pixel shananigans and seems like it would work just fine.

    So in the end, I am agreeing with jkd (just like always)!
    My Site {Mike's Adventures}

    Yikes, forums are almost too much fun.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So in the end, I am agreeing with jkd
    i think i am too
    redhead


  •  

    Posting Permissions

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