August 31, 201016 yr So, for example what 800px (that is my average page width) in percentages? I have tried to work it out by dividing 145px by the amount of space I have to fill, which is 655px; because the whole resolution for the width is a minimum of 1024 by 768px: The formula is: Method: (X / Y) * 100 = R Example: 3 / 26 = 0.11 | 0.11 * 100 = 11% [i also found a formula for text on webinmind.net] Examples: * For a 13px text: 13 / 16 = 0.8125 = 81.25% * For an 18px text: 18 / 16 = 1.125 = 112.5% ... I tried the text but, it's a little screwy in IE. (Like we expected any different =D) Enjoy mien fellow interwebbers, this is a beta thing for me too, if you spot an error, jump all over it ^^
August 31, 201016 yr Percentages are based on the size of the parent element. If you have a div set to 1000px and want to size a div within it to 800px using percentages, you would need a value of 80%. If the parent element is the body tag, a value of just under 80% (roughly 78%) is needed on 1024x768 monitors and a value of about 60% is needed for 1280x1024 monitors, assuming that the window is full-screened. I'm not sure where you're getting the value 145px from, but if you know this value and want it to remain constant (for example, if it's a side bar) then I'd recommend simply using pixel sizes. Font-sizes work in a similar way, but 100% is the full size of a letter in the parent element, as opposed to the height of the parent element itself. If it's a help, the default size of text in the body tag is 16px and a lot of style sheets start with this rule to re-sze that to 12: body {font-size: 62.5%;}
Create an account or sign in to comment