|
Posted by Jukka K. Korpela on 05/28/07 10:34
Scripsit Neredbojias:
> One significant difference is that padding will "propagate" the
> background of the div whereas margins will delimit it. Also, top and
> bottom margins may merge into adjacent margins, a situation which
> does not occur with padding. Thirdly, padding will allow for the
> placement of absolutely- positioned elements (within the relative
> container) "over itself" so to speak.
>
> I'm sure there are other differences as well.
Vertical margins do not affect non-replaced inline elements; vertical
paddings do (though this does not affect line height).
Some elements have default margin or padding. This may depend on browser.
Thus, if you wish to affect e.g. the indentation of a list, you should
always set both padding and margin for both the list element (ul or ol) and
the list items (li elements). Setting just e.g.
ul { margin-left: 0; }
or
ul { padding-left: 0; }
has radically different effects on different browsers.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Navigation:
[Reply to this message]
|