Text in eine DIV-Box mittig setzen

Status
Nicht offen für weitere Antworten.
So könnte ein möglicher Workaround aussehen, um im IE die gewünschte vertical-align-Deklaration zu erzwingen ;-)

Code:
<style type="text/css">
.box {
width:150px;
height:50px;
display:table-cell;
vertical-align:middle;
text-align:center;
border:1px solid #000;
}
</style>
<!--[if IE]>
<style type="text/css">
.box td {
height:50px;
vertical-align:middle;
}
</style>
<![endif]-->
Code:
<div class="box">
     <!--[if IE]><table><tr><td><![endif]-->
     box<br>box
     <!--[if IE]></td></tr></table><![endif]-->
</div>
 
So könnte ein möglicher Workaround aussehen, um im IE die gewünschte vertical-align-Deklaration zu erzwingen ;-)

Code:
<style type="text/css">
.box {
width:150px;
height:50px;
display:table-cell;
vertical-align:middle;
text-align:center;
border:1px solid #000;
}
</style>
<!--[if IE]>
<style type="text/css">
.box td {
height:50px;
vertical-align:middle;
}
</style>
<![endif]-->
Code:
<div class="box">
     <!--[if IE]><table><tr><td><![endif]-->
     box<br>box
     <!--[if IE]></td></tr></table><![endif]-->
</div>

Ja super, das meinte ich.

Gruss
 
Status
Nicht offen für weitere Antworten.
Zurück