when my page is displayed in internet explorer it acts all wierd. the whole page goes up and to the left. ive tried everything. thx in advance

  • Internet Explorer 8. works fine in firefox, opera, and safari. canyonchase1 almost 7 years ago
  • You need to provide the CSS file as well. o.k.w almost 7 years ago

2 answers

Rob 230
0
points
This was chosen as the best answer

You will never get IE to attempt to perform like other far more modern browsers without a proper doctype. Add this to your first line:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
Answered almost 7 years ago by Rob
  • its official...im an idiot. thank you i forgot to put that but now it works. thx again canyonchase1 almost 7 years ago
1
point

For others that have to deal with IE6, there is something else that needs to be addressed when centering a fixed layout.

Assuming this html snippit (assuming proper doctype, etc)

<body>
  <div id="content">All your content goes here!</div>
</body>

This code makes the div with id 'content' centered on the page, except in IE6:

div#content { 
    width: 960px;
    margin: 0 auto;
}

IE6 you need to set the body to text-align: center, then set the text-align back to left on a child element, like this:

body {
    text-align: center;
}
div#content {
    width: 960px;
    margin: 0 auto;
    text-align: left;
}

This will give you a properly centered, fixed-width layout in all the browsers, including IE6.

Answered almost 7 years ago by Bryan Rehbein