3 answers

Margins work on the outside of your div, while padding is added to the inside. When you add a padding to the top it adds the number of pixels that you added onto the height. Just subtract that from the height and it should work properly.

Example:

div.className { height:40px; }

-- I want to add 20 px of padding to the top of this div. That would make it:

This is a good solution, unless you want to have other text elsewhere in the div that uses < p > tags. If that's the case, it will probably overlap the text that is set to absolute (if the text is more than 1 line). If that happens you'll have to play with the height and padding of the div anyway to get the desired effect.