You are here: Re: Margins versus padding « HTML « IT news, forums, messages
Re: Margins versus padding

Posted by Jonathan N. Little on 05/05/06 17:56

Toby Inkster wrote:
> Michael Laplante wrote:
>
>> Is there any sort of design consideration that makes a designer choose one
>> over the other?
>
> padding is inside the box and will assume the same background as the rest
> of the box. margin is outside the box so has a transparent background,
> allowing the parent's background to show through.
>

Looking up padding and margin a w3.org first then a little
experimentation can go a long way...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>

<title>Margin VS Padding</title>

<style type="text/css">

..bymargin, .bypadding {
border: 1px solid red;
color: black;
background-color: yellow;
}
..bymargin {
margin: 100px;
padding: 0;
}
..bypadding {
margin: 0;
padding: 100px;
}
</style>
</head>
<body>
<div class="bymargin">DIV by margin...</div>
<div class="bypadding">DIV by padding...</div>
</body>
</html>


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

 

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

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