【发布时间】:2021-06-12 01:45:56
【问题描述】:
我不明白。这是一个非常简单的文档,我看不出它不应该工作的任何原因。
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>
据我所知,vertical-align 是用于 td 的,所以我不确定它为什么不起作用。
【问题讨论】:
-
vertical-align:middle;不起作用,因为您将锚的类设置为display:inline-block;,这意味着您尝试在“inline-block”中使用vertical-align:middle;,而不是“table-cell”
标签: html css vertical-alignment