I have a simple problem:
- I have an image inside of a div.
- In order to make the page more aesthetically pleasing, I’m going to add some additional padding to the image.
Rather than eyeball it, I’d like to know:
Are there any CSS padding heuristics that I can follow?
I was thinking that somebody of Jakob Nielsen’s caliber might have established some best practices about page layout and padding (i.e. minimum pixel padding or proportionality).
- I’m not claiming that this is an especially difficult problem to solve.
- But it’s a problem that will likely come up again.
- And I’d like some heuristics to guide my padding choices in the future.
Any help would be appreciated.
There actually are some standard formulas for this kind of thing.
((a+b)/a) = (a/b))or about 1.618.If your image is 100 pixels wide, you divide by the golden ratio until you get something that’s not WAY to big.
So golden ratio numbers for 100 pixels are 62, 38, 24, 15, 9, 6, 4, 3, 2, 1. In ems you can use fractional widths, so you wind up with 14.5, 9, 5.6 etc.
em units are a function of the width of your “m” in the font, so in CSS they can change throughout the page.
The “measure” is the width of line of text. You want your measure to be less than 2 to 2.5 alphabets. (You measure an alphabet by typing the abcdefg… twice.)
The Colin Wheildon brochure / book Communicating or Just Making Pretty Shapes has some excellent advice for laying out typography and images. It’s largely oriented toward print, but most of the same principles still apply.