N'Abend allerseits.
Jup, das is nich einfach. Horizontales Zentrieren geht ja mit margin:auto
ganz locker; vertikal sieht das anders aus; vertical-align funktioniert nur,
wenn das (umrahmende) Element ein inline-Element ist (span, img, a,...),
aber nicht bei body, divs etc. Allein mit CSS seh ich hier keinen Weg.
Vllt. aber so: Man lässt das div #root da wo es ist (top:0px oder ähnlich),
den Rest erledigt dann ein JavaScript, d.h.
In der style_de.css bei #root die top- und die margin-top-Angabe entfernen.
In der .html erledigt dann ein Script die Sache (body: onload beachten):
- Code: Alles auswählen
<script type="text/javascript">
function fixmt()
{
var y;
if (self.innerHeight) // all except Explorer
{ y = self.innerHeight; }
else if (document.documentElement && document.documentElement.clientHeight)
{ y = document.documentElement.clientHeight; } // Explorer 6 Strict Mode
else if (document.body) // other Explorers
{ y = document.body.clientHeight; }
var root = document.getElementById('root');
if (y - root.offsetHeight > 0)
root.style.top = (y - root.offsetHeight)/2 + 'px';
};
</script>
</head><body onLoad="fixmt()">
Den y-Teil (if) hab ich von
quirksmode, dort 'cross browser scripts'.
Das Ding beschafft sich die verfügbare Höhe, zieht davon die #root-Höhe ab;
wenn dabei etwas Positives 'rauskommt, wird das halbiert und als #root-top gesetzt.
Wenn JavaScript abgeschaltet ist, bleibt der natürliche top-Wert (0px) wie er ist.