Solved

Background not centered correctly with website

Posted on 2006-10-25
2
234 Views
Last Modified: 2011-10-03
I have a 770px x 1px white image that lays right in the middle at the top of a page and continues repeating vertically, so it looks like a white column. Well, after putting a footer on the page, it looks like it's off-center. My table is set to 770px wide (same width as the background) and set to center of the page. Can anyone help me?

Here's a pic of what I'm talking about:  http://img110.imageshack.us/my.php?image=cssproblemul8.jpg


And here's what my CSS looks like:

body {
      font-family: Tahoma, Arial, sans-serif;
      font-size: 11px;
      font-weight: normal;
      color: #000000;
      background: url(../../images/backgnd.gif) repeat-y top center #000000;
      margin-top: 0px;
      margin-left: 0px;
}
0
Comment
Question by:ecosvaldo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
HackneyCab earned 50 total points
ID: 17805207
You're using a table for layout? That's not a great idea.

To centre the body element, use this:

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

or use this for a shortcut:

margin: 0px auto;

which sets the top and bottom margins to zero, and the left and right to auto. Which should centre the body element within the html element.

Use the same setting to centre other elements within the body element.

Using tables for layout is generally frowned upon these days, for several reasons.
0
 

Author Comment

by:ecosvaldo
ID: 17805415
Thanks HackneyCab! You helped me out.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question