Solved

Background not centered correctly with website

Posted on 2006-10-25
2
197 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
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now