PDA

View Full Version : Adding margins


Kane
04-02-2009, 05:30 PM
Hello

My page covers the whole screen. Is there a way to insert a margin on both the right and left hand side of the page or is it better to leave it the way it is?

http://img218.imageshack.us/img218/5108/margins.jpg

mangofreak
04-02-2009, 05:47 PM
<div styles="padding-left:10px;padding-right:10px;">
your text goes here

</div>

Increase the pixel amount if you need more margin.

Kane
04-02-2009, 06:01 PM
Thanks, I'll do it right now

coloeagle
04-02-2009, 10:34 PM
Remember that padding adds space on the inside of the div and margin will add space to the outside of the div.

There are a few ways this can be coded for your desired effect.

You can use
margin-left:20px;
margin-right:20px;

Or you can set your pages to a percentage width of the window and then set the left and right margins to auto. This will keep your pages centered in the good browsers, but for IE you will need to add text-align:center;

Kane
04-03-2009, 10:27 AM
Thanks a lot, slowly but surely, I’ll get to have a decent web site with the help of you guys.