我有一个设置了宽度并被包裹在链接中的
。我希望里面的链接填满整个
的空间,以便在我点击
内任何地方(我已经将其样式设置为按钮)时,它都可以转到链接。这是我的尝试,但.link_class不能实现我想要的效果。有什么建议吗?
HTML:
HTML:
<div class="button_class">
<a class="link_class" href="http://www.my_link.com>My Link</a>
</div>
CSS:
.button_class {
width:150px;
padding:5px 7px;
color:#fff;
text-align:center;
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
}
.link_class {
width:100%;
height:100%;
}
.link_class
中使用display:block
,它会起作用。 - The Mechanic