Background image styles

Adding a background image and locking the width of the design.

Next up, we'll add a background image to the site, as well as locking the width to 840 pixels. Add the following to your CSS and refresh:

    /* The background + logo styles */
    body {
        background: url(bg_light.gif);
        width: 840px;
        margin: auto;
    }

    #visual-portal-wrapper {
        margin: 20px;
        background-color: white;
        padding: 0 20px 20px 20px;
    }

    #portal-logo {
        display: block;
        margin-bottom: 2em;
    }

One of the things worth paying attention to here is the margin: auto part. This is the way you generally center things in CSS, and a lot of people don't know that — they expect there to be a float: center or something similar. Now you know how to do it, and if you refresh, your site will look like this:

Amazing what adding a simple background does to the design, isn't it? Onwards!