You are here: Re: margin or padding? « HTML « IT news, forums, messages
Re: margin or padding?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация