Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Background not centered correctly with website

Posted on 2006-10-25
2
Medium Priority
?
244 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 200 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Suggested Courses

610 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