PDA

View Full Version : DIV Questions



Luke
02-01-2010, 10:23 PM
Hey, not familiar with divs and css, so got a couple of questions.

I have the container, and i want it in the center of the screen, but i don't want the text centered, how would I go about this?

And in this content box, how would i put a 5px "indent" on the left and right so the text isn't right at the edge like this:
http://img5.imageshack.us/img5/7976/testvp.png

Many Thanks
Luke

Jamesy
02-01-2010, 10:32 PM
First one:

margin-right:auto;
margin-left:auto;

Second:
padding-left:<number>px;
padding-right:<number>px;

Luke
02-01-2010, 11:03 PM
First one:

margin-right:auto;
margin-left:auto;

Second:
padding-left:<number>px;
padding-right:<number>px;

Thanks, however the padding done this:
http://img218.imageshack.us/img218/4624/wrongu.png

Jamesy
02-01-2010, 11:07 PM
minus from the width the sum of the padding.

For example if your code was:


width:200px;
padding-left:10px;
padding-right:10px;


you'd change the width to be 180px to counter act the addition of padding.

Luke
02-01-2010, 11:14 PM
minus from the width the sum of the padding.

For example if your code was:


width:200px;
padding-left:10px;
padding-right:10px;


you'd change the width to be 180px to counter act the addition of padding.

That's great! Thanks +rep
Edit: Gotta spread, sorry

Want to hide these adverts? Register an account for free!