简体   繁体   English

CSS高度100%在TD上不起作用

[英]CSS height 100% not working on TD

I don't understand why height 100% for css link is not inheriting height value pointed at td or table? 我不明白为什么CSS链接的高度100%不继承指向td或表的高度值? But width value with 100% inherits value of the td or table. 但是宽度值为100%的值继承了td或表的值。

 .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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM