I am trying to create a square element that will have text centered both vertically and horizontally. In addition, the entire square must be a reference. This is my HTML:
<div class="w1h1 medium"> <a class="userLink" target="_blank" href="Fancybox.aspx"> <table style="width: 100%; height: 100%"> <tr style="vertical-align: central"> <td style="text-align: center; font-weight: bold;"> text in the middle </td> </tr> </table> </a> </div>
And this is my CSS:
div.w1h1 { width: 150px; height: 150px; } .medium { background-color: #06849b; color: white; font-family: sans-serif; } a.userLink { width: 150px; height: 150px; display: table; color: #FFFFFF; text-decoration: none; }
It works in Chrome and Firefox, but not in Internet Explorer. In IE, the text is at the top of the square, not in the middle. Can you help me?
I just created a playground here: http://jsfiddle.net/Tschareck/yfnnm/
html css
Tschareck
source share