我使用描述的解决方案文本在如何对齐的这一直设置为超链接
How can I make a link from a <td> table cell
,使我的表中的超链接的TD条目。这是一个不错的简单解决方案。但是当我使用display:block;时会产生副作用。超链接文本向上移动一点而不居中。下面的图片显示了这个问题。如果你看看选定的td“主”,你会发现它太高。
否则,它是完美的突出TD线与蓝色日这就是我想要的。
我该如何解决这个问题?
的,简化的,代码我使用
----html----
<td>
<div style="height:100%;width:100%;">
<a href="my_url">
primary
</a>
</div>
</td>
----css----
table {
background-color: White;
border: 10px solid Blue;
border-radius: 13px;
border-collapse: separate;
width: auto;
margin-top: 5px;
}
table th, td {
color: Black;
vertical-align: middle;
font-size: 20px;
font-weight: bold;
border: 0;
padding: 0px;
}
table th {
color: White;
background: Blue;
}
table a {
color: Black;
text-decoration: none;
display: block;
width: 100%;
height: 100%;
padding: 0px;
}
table a:hover {
color: White;
background: Blue;
}
'表TD {文本对齐:中心;}' –
没有这样的运气。我试过,但它似乎被忽略时显示:块;用来。可以肯定,我把它设置在td,a和div上。 –