This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Stylesheets > July 2007 > Padding or Margin





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Padding or Margin
adminloozer@gmail.com

2007-07-27, 6:22 pm

Hello,

I've some difficulities when using padding or margin to position an
element (alone on page alongside other elements OR inside another
parent element). Can I say usually I will use margin to position or
create some room between parent elements and padding to position or
create some room between a parent element and child elements like a
header with its links bar, search div, image div...
If someone can tell me when using margin and padding it will help
me.
Ithk to all.

PS: my question is not about absolute, fixed, relative or float
position - only when to use margin or pdding to create room between
elements.

Bergamot

2007-07-27, 6:22 pm

adminloozer@XXXXXXXXXX wrote:
>
> when to use margin or pdding to create room between elements.


Margin is outside the element borders, padding is inside. Which to use
depends on your particular design. See also
http://brainjar.com/css/positioning/

--
Berg
Andy Dingley

2007-07-27, 6:22 pm

On 27 Jul, 14:06, adminloo...@XXXXXXXXXX wrote:

> I've some difficulities when using padding or margin


If in doubt, use margin.

When you've learned how it all works, start to use padding. This might
be once you start needing borders.

Learn about "Collapsing vertical margins"

The brainjar article is one of the best resource around. It's good for
explaining float too.

Gus Richter

2007-07-27, 6:22 pm

adminloozer@XXXXXXXXXX wrote:
> Hello,
>
> I've some difficulities when using padding or margin to position an
> element (alone on page alongside other elements OR inside another
> parent element).
> PS: my question is not about absolute, fixed, relative or float
> position - only when to use margin or pdding to create room between
> elements.


Use margin to position a container and padding to position the content
(away from the container). The content itself will have its own margin
and padding, allowing for additional control/needs and remember the
border between margin and padding.

--
Gus
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews