Margin:0 auto simply not working

Hello all, sorry to be so needy.

I have no clue what I’m doing wrong. It was working for awhile and suddenly stopped. I have a feeling I’ve added an element that has broken everything, but after pouring over the code for a few hours I’m not sure what.

It’s very messy, so apologize. Also if anyone has any remarks on a good four column structure, it’d be much appreciated. I think I have it (EDIT: I did have it, and if fixed, it would start working again but I want to make sure there isn’t a more perfect way of doing them.) but I feel like my build will eventually hit a wall.

CSS

/* simple reset to give good cross-browser baseline */
html,body,address,blockquote,div,
form,fieldset,caption,
h1,h2,h3,h4,h5,h6,
hr,ul,li,ol,ul,
table,tr,td,th,p,img {
}

img, fieldset {
border: none;
}

hr {
display: none;
}

body {
font-size: 90%;
font-family: calibri,verdana,helvetica,sans-serif;
background:#FFFFFF;
margin-top: 30px;
text-align: center; /*center #pageWrapper in IE 5.x */
}

#signature {
position: relative;
margin: 30px 30px 70px;
background-image:url(image/CCSignature.jpg);
repeat: x-axis;
height: 77px;
width: 368px;
border: none;
}

#signature img {
display: none;
}

h1 {
position: relative; /* wrap floats */
padding: 0;
font-weight: bold;
font-size: 115%;
font-family: "calisto mt", helvetica, verdana, sans-serif;
font-color: black;
overflow: hidden;
}

p {
padding: 10px 0 0 0;
font-size: 105%;
}


#textWrapper {
margin-left: 0 auto;
margin-right: 0 auto;
width: 760px;
padding: 0 auto;
text-align:left;
}


#navBar {
list-style: none;
font-size: 1px;
padding-top: 10px;
text-align: center;
border-bottom: 1px solid #666;
white-space: nowrap;
}

#navBar li {
display:inline;
}

#navBar hr {
display: block;
background-color: black;
}

#hrNull {
display: none;
}

#navBar a {
display:-moz-inline-block;
display:-moz-inline-box;
display: inline-block;
font-size: 18px;
white-space: nowrap;
text-decoration: none;
color: black;
padding: 10px 60px;
}

#navBar a:active,
#navBar a:focus,
#navBar a:hover {
background: #67A 0 no-repeat;
}

#navBar a:hover {
color: gold;
}

/* This is all for the overall layout of the website */

#columnWrapper {
position: absolute;
margin-left: 0 auto;
margin-right: 0 auto;
}

#column1, #column2, #column3, #column4, #column5wide, #column6wide {
padding-top: 30px;
}

#column1 {
position: absolute;
width: 211px;
}

#column2 {
position: absolute;
width: 211px;
margin-left: 241px;
}

#column3 {
position: absolute;
width: 211px;
margin-left: 482px;
}

#column4 {
position: absolute;
width: 211px;
margin-left: 723px;
}

#column5wide {
position: absolute;
width: 633px;
margin-left: 241px;
}

#column6wide {
position: absolute;
width: 422px;
margin-left: 482px;
}

/* The About Us Navigation Bar */
/* The About Us Navigation Bar */

#aboutBar {
list-style: none;
/* font-size: 1px; */
/* For IE? */
padding-top: 0px;
text-align: left;
white-space: nowrap;
}

#aboutBar li {
line-height: 30px;
}

#aboutBar hr {
display: block;
background-color: black;
}

#hrNull {
display: none;
}

#aboutBar a {
font-size: 110%;
white-space: nowrap;
text-decoration: none;
color: black;
padding: 5px;
}

#aboutBar a:active,
#aboutBar a:focus,
#aboutBar a:hover {
background: gold 0 no-repeat;
}

#aboutBar a:hover {
color: red;

/* Less important styling elements */

ul {
font-size: 90%;
padding-top: 10px;
padding-left: 20px;
}

HTML

<html>
<head>
<title>About Us | The 55th College Council</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="CC_CSS_3.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="textWrapper">

<div id="signature">
<img alt="The College Council Logo &#8212;*We welcome you!" src="">
</div>

<ul id="navBar">
<li><a href="">about us</a></li>
<li><a href="">minutes</a></li>
<li><a href="">opinions</a></li>
<li><a href="">calendar</a></li>
<li><a href="">contact us</a></li>
</ul>

<div id="columnWrapper">

<div id="column1">
<h1>About Us</h1>
<p>The College Council is the <b>undergraduate student governance organization.</b></p>
<p>Some of the things we do are:</p>
<ul>
<li>Advocate for student concerns and interests.</li>
<li>Charter student groups within the Emory College of Arts & Sciences.</li>
<li>Provide funding for these groups.</li>
<li>Put on various programs for the student body, for example, the annual <i>State of Race.</i></li>
</ul>
</div>

<!-- Careful! This is a table --!>
<div id="column2">
<ul id="aboutBar">
<li><a href=""><b>Executive Board</b></a></li>
<li><a href=""><b>Legislature</b></a></li>
</ul>
</div>


<div id="column6wide">
<p>Test test test test test test test test test.</p>
</div>

</div> 

</div>
</div>
</body>
</html>

Hi kp606,
No need to start your post with apologies, we are here to help. :slight_smile:

margin:0 auto simply not working.
Here’s the problem, you have set two values on properties that can only have one value. If you would have just set margin:0 auto; as you had it in your thread title everything would have worked.

#textWrapper {
[COLOR=Red]margin-left: 0 auto;
margin-right: 0 auto;[/COLOR]
width: 760px;
[COLOR=Red]padding: 0 auto;[/COLOR]
text-align:left;
}

You should also take note that auto is not a valid value for padding.

Give this a go -

#textWrapper {
[COLOR=Blue]width: 760px;
[/COLOR][COLOR=Blue]margin: 0 auto;
padding: 0;[/COLOR]
text-align:left;
}

As for your columns: I have not ran your code in a browsers yet but you would be better off loosing the absolute positioning and floating them all left.

Another reason why it wouldn’t work in IE is that because the page has no doctype it is in quirks mode where it doesn’t handle centring that way.

Do you need a DOC type for testing from the hard drive?

Also—is there a clever way to test something’s capability in IE if you owned a Mac?

Try as I might, I can’t download IE. :blush:

Doesn’t matter where you test it on IE, IE will behave as if it’s IE, no matter what situation :).

You could use virtualOS software to run IE on that :slight_smile:

You should have a doctype anyway as that is what identifies what language you are writing in as being HTML. If you write in gibberish instead of HTML then your CSS has no way of knowing what it is supposed to be styling.

You should be working with a valid doctype from step one - When I write a page usually I start out with the following bare template as my starting point:

http://battletech.hopto.org/html_tutorials/template.html

That contains the elements that most every page IMHO should have at minimum - and is the baseline every page I write is built upon these days.

Yeah, get a real computer and not a fisher price “my first computer” :wink:

Jokes aside, the mac is kind-of tying one hand behind your back for serious web development, and the fix is to run windows in one way or the other on it.

Bootcamp to reboot into windows can be a bit of a pain in the ass, so the best suggestion is to use a VM software and run XP (and maybe even 7) inside it. I advise against VMWare since it tends to hijack the host OS, and OSX is slow enough as it is without adding more headaches - for the mac the best two choices are Parallels fusion, or Oracle Virtual Box… I prefer Virtual Box because it’s free.

The last version of IE for the tinkertoy was 5.2, and official support (and official downloads) of IE on the quackintosh officially ended five years ago. It’s pretty much useless for testing how windows IE will behave anyways.

Once you have a VM software you’ll need a copy of windows to install in it - thankfully these days valid unused XP licenses aren’t that hard to come across with people upgrading to 7. The best approach I’ve found is to make two XP installs - one for IE7 with tredosoft’s IE6/earlier standalones, and one updated all the way to IE8 since IE7 and IE8 don’t co-exist particularly well.

As to your code problem, there’s a lot of ‘good practices’ you might not be aware of on your page. Empty href often make anchors not respond to hovers in all browsers, so for testing you should at LEAST put in a ‘#’ so that you’ll be able to test that. Tabs to indent when you start a new block make it clear if you are properly clearing all your div or not - white-space stripping being kind-of silly since at best it saves 300 bytes on a properly written page, savings can be better found elsewhere - as already discussed a doctype is a good idea, as is a MEDIA type on your LINK for the CSS. Avoid using complex non-ascii characters on english language pages (like the double – in the image alt) since there’s no reason for them and it’s a editing headache - ESPECIALLY with ISO-8859-1… and avoid comments between things like columns since that can cause IE to trip all sorts of nasty rendering bugs. (YES, I SAID COMMENTS can trip bugs!)

The indenting part is very important since it would have pointed out you are closing three div that aren’t even open.

Already mentioned is don’t even try using absolute positioning for columns - Your last DIV there will ride up undereath, you end up forced to try and fix the heights on your content which almost universally ends up an accessibility /FAIL/ and a maintennence headache when you add or remove content.

You also seem to have declared margins and paddings on elements in something of a nonesenical manner… Your setting position:absolute without setting actual positioning – so I’m not even sure how you expected that to look or what you are aiming for in terms of appearance.

Yes but the problem is “$.”

I will do what I can, in the meantime. Thank you everyone.

http://www.virtualbox.org/

All you then need is a copy of XP to install in it… which if you’re … thrifty, shouldn’t cost much of anything.

Off Topic:

:rofl::rofl:

A copy of XP doesn’t cost much these days ( what with vista and 7 out :))