View Full Version : css div container help!

08-13-2011, 09:56 PM
Hi there. I'm quite new to css, and I've been looking all over google to center my content in a page, very much like www.skittles.com. I wasnt able to find out how to do it, does anyone know how to do this Also, I wouldnt mind knowing how to put a background image behind the container aswell, like the sky affect on the skittles website. Thank you very much for any help provided!.

08-13-2011, 10:02 PM
margin: 0 auto; will set an "auto" margin on each side of the "container". This auto will be the same size on each side, and is calculated based on the width of the container (so you need to define a width for margin: 0 auto; to work.

.container {
width: 1000px;
margin: 0 auto;

<div class="container">
<!-- Header, Content, Footer -->


that sky background is done in photoshop. to place it in the background, they probably set it to the body

body {
background: url('/ .png') 0 0 no-repeat;

<div class="container"></div>

08-13-2011, 10:33 PM
Thank you very much for your help!.