Search code examples
htmlcssvertical-alignment

"vertical-align:middle;" is not working inside td


I don't understand. This is a very simple document and I can't see any reason it shouldn't work.

CSS:

.button {
    background-color: transparent;
    border-radius: 50%;
    border: 5px solid #ff0099;
    display: table-cell;
    vertical-align: middle;
    height: 175px;
    width: 175px;
    text-decoration:none;
    text-align: center;
    word-wrap: break-word;
}
.button:hover {
    text-decoration: underline;
}
.button p {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 100;
}
table {
    border-spacing: 20px 10px;
    border-collapse: separate;
}
td {
    vertical-align:middle;
}

HTML:

<table>
    <tr>
        <td>
<a href="#" class="button" target="_blank"><p>Insert text here, enough to push it over the edge</p></a>

        </td>
        <td>
<a href="#" class="button" target="_blank"><p>Insert text here, enough to push it over the edge</p></a>

        </td>
    </tr>
</table>

As far as I know, vertical-align was meant for use in td's, so I'm not sure why it isn't working.


Solution

  • Add below code to button css . Refer http://jsbin.com/kixewufe/2/ to view http://jsbin.com/kixewufe/2/edit?html,css,output to view complete code.

    vertical-align:middle;
    display:inherit;