I’m making a website for a project, and I’ve used percentages to float my divs for cross compatiblity across multiple resolutions/browsers. It seems to work fine for Firefox, Safari, etc. but the major problem comes with IE 9. The items just seem to stay put in the upper left corner. Any ideas?
CSS:
#center-container {
width: 960px;
height: 100%;
margin:0 auto;
}
img#google {
padding-top: 17%;
padding-left:35%;
margin: 0 auto;
}
form#searchBox {
padding-top: 25px;
padding-left:25%;
margin: 0 auto;
}
#buttons {
padding-top: 20px;
padding-left: 40%;
}
HTML:
<div id = "center-container">
<img id="google" src="images/google.png" width="275" height="95" />
<form id="searchBox">
<input type="text" id = "search" name="search" size="85"/><br />
</form>
<div id="buttons">
<a href="javascript:void(0)" onClick="searchCensor()" class="button">Google Search</a>
<a href="#" class="button">I'm Feeling Lucky</a>
</div>
</div>
Website: andrewgu12.kodingen.com/history
Youre missing a DOCTYPE statement, and as such IE is in quirks mode
http://www.quirksmode.org/css/quirksmode.html
Use a doctype, even a HTML5 doctype will work fine.