Solved

Center Web Page Not Working

Posted on 2011-02-12
5
408 Views
Last Modified: 2012-05-11
An update page I am working on  is at http://www.dciscancer.com/index2011.php

In Code View you can see:
<div id="Centered">
at the top of the body.
I close it just above  </body>

The tag is in the linked .css file a reads as follows:
Centered {
      position: relative;
      margin-left: 100px;
      margin-right: auto;
      margin-top: 0;
      margin-bottom: 0;
      width: 1024 px;
}

I use this many other websites to center the page on the browser screen.
It works at http://www.thebicyclesite.com and http://www.liccsc.org, for example.
Here it is not doing anything and I cannot figure out why.
0
Comment
Question by:glenn_1984
  • 2
  • 2
5 Comments
 
LVL 16

Assisted Solution

by:SSupreme
SSupreme earned 200 total points
ID: 34879494
Add to your css this code instead Centered:
#Centered {
    margin: 0 auto;
    position: relative;
    width: 900px;
}

Open in new window

0
 
LVL 20

Accepted Solution

by:
thehagman earned 300 total points
ID: 34879676
So before you merely edit the margin property, take a close look at SSupreme's complete CSS code: You used "Centered" instead of "#Centered", which would apply to a (ficticious) tag <Centered>...</Centered>
0
 
LVL 16

Author Comment

by:glenn_1984
ID: 34879896
I figured it was a stupid error.

I added the # to Centered...no idea why, in a long .css file I did not notice that :)

The margin: 0 auto;  has no effect.  I tested with and without.

Thanks.
0
 
LVL 16

Expert Comment

by:SSupreme
ID: 34880365
If you tested it without the width, then there is no place for margins to exist, except 0 margins. Please follow the instruction next time.
0
 
LVL 16

Author Comment

by:glenn_1984
ID: 34880527
I DID  use the width. What I did not use was  margin: 0 auto;

It is now running live at http://www.dciscancer.com.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

786 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