|
-
Sep 24th, 2007, 01:19 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] why does this not centre in IE?
I have some code for my header:
HTML Code:
<body>
<div id="header">
<div id="logo">
<h1><a href="http://www.mysite.co.uk">My site</a></h1>
</div>
</div>
<div id="header2">
<div id="menu">
<ul>
<li ><a href="all.php">All</a></li>
<li ><a href="womens.php">Women</a></li>
<li class="current_page_item"><a href="mens.php">Men</a></li>
</ul>
<ul>
</div>
</div>
And the CSS:
HTML Code:
#header {
float: middle;
padding: 0px 0 0 0;
width: 340px;
height: 70px;
margin: 0px auto;
}
#header2 {
padding: 20px 0 0 0;
width: 620px;
height: 70px;
margin: 0px auto;
text-align: center;
}
#logo {
float: middle;
padding: 20px 0px 0 0;
}
#logo h1 {
margin: 0;
text-transform: lowercase;
letter-spacing: -0px;
font-size: 3.6em;
font-weight: normal;
color: #FFFFFF;
}
#logo h1 a {
padding-right: 20px;
background: url(images/img02.gif) no-repeat right top;
text-decoration: none;
color: #FFFFFF;
}
#menu {
float: middle;
}
#menu ul {
margin: 0;
padding: 0;
list-style: none;
}
#menu li {
display: block;
float: left;
height: 82px;
}
For some reason the header appears fine on Opera and Firefox - centred. In IE(7) however its just left-aligned.. Any ideas why??? And how do I fix it so its just centred??
Thanks!
-
Sep 24th, 2007, 11:23 PM
#2
Re: why does this not centre in IE?
To have margin : 0 auto; working you have to make sure you have a Strict DOCTYPE and that it is the first thing in the file (no spaces or extra characters or XML prolog before it).
On the other news, I've never seen float : middle; before.
-
Sep 25th, 2007, 12:28 AM
#3
Re: why does this not centre in IE?
why don't you try "align: center;"?
and I would remove the "padding: 0px 0 0 0;" part
Delete it. They just clutter threads anyway.
-
Sep 25th, 2007, 06:01 AM
#4
Re: why does this not centre in IE?
padding: 0; does what it says, removes padding: in case #header happens to be a real header element, it may have (unwanted) padding assigned so it must be removed separately.
There is no align: center;, you can find text-align: center; but that should only work for text (but it does work "as wanted" in IE, if you set it to the parent element - just that it also centers the text, so you have to undo that in the child elements).
-
Sep 25th, 2007, 01:31 PM
#5
Thread Starter
Hyperactive Member
Re: why does this not centre in IE?
Code:
To have margin : 0 auto; working you have to make sure you have a Strict DOCTYPE and that it is the first thing in the file (no spaces or extra characters or XML prolog before it).
Thanks - that worked!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|