我不明白为什么 css 链接的高度 100% 不继承指向 td 或 table 的高度值?但是100%的宽度值会继承td或table的值。
.mybutton a {
display: block;
width: 100%;
height: 100%;
background: #666666;
color: #FFFFFF
}
.mybutton a:hover {
display: block;
width: 100%;
height: 100%;
background: #666666;
color: #FFFFFF
}
<table border="0" cellpadding="0" cellspacing="0" width="210" height="50">
<tr>
<td width="210" height="50" class="mybutton"><p align="center"><a href="#">BUTTON</a></p></td>
</tr>
</table>
最佳答案
对 p
标记元素使用 height:inherit
。
关于html - CSS 高度 100% 在 TD 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43675499/