Natürlich musst Du die Breite u. Höhe noch Deiner Seite anpassen - und den Inhalt dort einfügen, wo jetzt "Das ist nun der Inhalt des DIVs" stehtHTML-Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Horizontal und vertikal zentriert</title> <style> html { background-color: #FFFFFF; margin: 0px; padding: 0px; } body { margin: 0px; padding: 0px; } .box { border: thin solid #000000; background-color: #CCCCCC; position: absolute; top: 50%; left: 50%; margin-top: -150px; margin-left: -150px; height: 300px; width: 300px; overflow: auto; } .inhalt { width: 100%; margin: auto; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; text-align: center; } </style> </head> <body> <div class="box"> <div class="inhalt"> Das ist nun der Inhalt des DIVs </div> </div> </body>.
Wobei ich ein gutes Ergebnis bezweifle - schließlich ist Deine Seite von den Abmessungen ziemlich groß, das kann man schlecht zentrieren.


LinkBack URL
About LinkBacks
Zitieren
.