Hacker News new | ask | show | jobs
by joahua 5550 days ago
You can't really. CSS backgrounds are the main reason you need to use padding (instead of margin): margins exist outside an element, while padding expands within the box itself (beyond the content, but permitting the background to remain visible).

To visualize it, http://hicksdesign.co.uk/boxmodel/ is probably the most oft-cited example - certainly the one I find most helpful.

1 comments

Ok, I was talking about transparent elements, where in fact you have complete choice (at least if you have no borders too).