Sto provando a centrare un DIV, con "margin:auto"
. Funziona bene con Chrome e FF, ma il seguente codice non centrare il div con IE:Centering DIV con IE
CSS
#container {
margin:auto;
width:950px;
height:50px;
background:#000;
}
HTML
<div id="container"></div>
Che cosa sto facendo di sbagliato?
Grazie,
Joel
Modifica (completo di codice HTML/CSS):
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.2.0/build/cssreset/reset-min.css">
<style>
#container {
margin: 0 auto;
width:950px;
height:50px;
background:#000;
}
</style>
</head>
<body>
<div id="container"></div>
</body>
</html>
Quale versione di IE hai testato questo codice con? Normalmente definisco un 'width' e poi settaggio' margin: 0 auto' e funziona bene anche in IE ... –
Provato con IE9! Il codice che ho usato sopra ... – Joel
Vero, ma come disse Sime usa il margine: 0 auto; Hai solo margine: auto – Rob