我想删除下划线。我已经把 text-decoration: none;
。但是它不起作用。这是一个 DEMO 。
HTML
<a href="./index.php?sign_in=1">
<div id="signup_button">
Sign up
</div>
</a>
CSS
#signup_button {
position: relative;
max-width: 206px;
min-height: 20px;
max-height: 40px;
margin: auto;
margin-top: 10px;
padding: 10px 10px 10px 10px;
background-color: #0096cc;
text-align: center;
color:#fff;
font: 35px/1 "Impact";
text-decoration: none;
}
最佳答案
text-decoration
属于“a”标签,但你也可以去掉div。
如果在 a 上设置 display:block,效果相同
<a href="./index.php?sign_in=1" class="signup_button">Sign up</a>
现在看起来完全一样
<a href="./index.php?sign_in=1">
<div class="signup_button">
Sign up
</div>
</a>
使用
.signup_button {
position: relative;
max-width: 206px;
min-height: 20px;
max-height: 40px;
margin: auto;
margin-top: 10px;
padding: 10px 10px 10px 10px;
background-color: #0096cc;
text-align: center;
color:#fff;
font: 35px/1 "Impact";
display:block;
}
a {
text-decoration: none;
}
.signup_button {
position: relative;
max-width: 206px;
min-height: 20px;
max-height: 40px;
margin: auto;
margin-top: 10px;
padding: 10px 10px 10px 10px;
background-color: #0096cc;
text-align: center;
color: #fff;
font: 35px/1"Impact";
display: block;
}
a {
text-decoration: none;
}
<a href="./index.php?sign_in=1" class="signup_button">Sign up</a>
<p><hr /></p>
<a href="./index.php?sign_in=1">
<div class="signup_button">
Sign up
</div>
</a>
关于html - 删除 URL 中的下划线 [text-decoration : none; doesn't work],我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19005005/