Discussione: [CSS] Problemino...
View Single Post
Old 13-06-2005, 21:20   #10
lombardp
Senior Member
 
L'Avatar di lombardp
 
Iscritto dal: Jun 2002
Cittā: Firenze
Messaggi: 630
Questo un esempio di come centrare verticalmente e orizzontalmente un blocco DIV, dovrebbe funzionare su tutti i browser.

Il codice č un po' particolare ma funziona bene.

Spero possa esserti d'aiuto.

Codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><style>
#centrato {
   position: absolute;
   left: 0px; top: 50%;
   height: 1px; width: 100%;
   overflow: visible;
   }
#contenuto {
   position: absolute;
   margin-left: -50px;
   top: -25px; left: 50%;
   width: 100px; height: 50px;
   background-color: #ffeeee;
   }
</style></head>
<body>
<div id="centrato"><div id="contenuto">SONO AL CENTRO</div></div>
Content content content content content content content content content<br /><br /><br />
Content content content content content content content content content<br /><br /><br />
Content content content content content content content content content<br /><br /><br />
Content content content content content content content content content<br /><br /><br />
Content content content content content content content content content<br /><br /><br />
Content content content content content content content content content<br /><br /><br />
Content content content content content content content content content<br /><br /><br />
</body>
</html>
__________________
---> Lombardp
CSS Certified Expert (Master Level) at Experts-Exchange
Proud user of LITHIUM forum : CPU technology
Webmaster of SEVEN-SEGMENTS : Elettronica per modellismo
lombardp č offline   Rispondi citando il messaggio o parte di esso