Forum Moderators: not2easy

Message Too Old, No Replies

Question about adding space between border and form

         

nicknick

10:33 am on Aug 27, 2008 (gmt 0)

10+ Year Member



i have a form and would like to place space between the border and the form ?

I alos have a heading with which i would like to do the same ?

is the padding function ? in css ?

swa66

12:03 pm on Aug 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, assuming a normal box model (i.e. disregarding any curve ball IE will throw you)

Look at the drawing in [w3.org...]

Padding sits between the content and the border, margin sits outside of that. This is regardless of what the element is.

Now the content has a size, it the standards model (read: IE users beware) this is the size you set with e.g. width.
The padding has a thickness, as do the border and the margin.

So you can make an element have a size, place a padding around it (gets the background color as needed), place a border around that, and have a margin around the border.

E.g.:


#id {
width: 100px;
padding: 10px;
border: 1px solid black;
margin: 6px 0 20px 0;
}

This gives the element's content a width of 100 pixels
Gives that content a padding of 10pixels all around
Draws a border of 1 pixel thick, in black around it
Sets a top margin of 6 pixels, a bottom one of 20 pixels and set the left and right margins to zero.

Hope this helps, provide some code if you need more help.

nicknick

5:55 pm on Aug 27, 2008 (gmt 0)

10+ Year Member



Thanks , was just what i was looking for ..

i used the padding-left and it sorted out most of my problems in mozilla.

thanks alot.