显示下划线的文本下划线

时间:2013-08-20 17:21:08

标签: html css underline

我似乎遇到了Underline的问题。我有一个可链接的盒子:

<div class="single_box">
   <a href="servicesweprovide.asp"><img src="images/law_enforcement_accreditation.jpg" alt="" />
   <p>Law Enforcement<br />Accreditation</p></a>
</div>

这是CSS:

.single_box {
    width:253px;
    min-height:170px;
    float:left;
    margin:0px 15px 0 0;
    padding:0px;
    text-decoration:none;
}
.single_box p{
    background:url(../images/arrow.png) 92% 50% #0b2e84 no-repeat;
    font:bold 16px/18px  Arial, Helvetica, sans-serif; color:#fff;
    padding:6px 14px;
    word-spacing:normal;
    letter-spacing:normal;
    font-stretch:normal;
    cursor:pointer;
    text-decoration:none;
}
.single_box p:hover {
    background-color:#ffc210;
    text-decoration:none;
}

我在JFiddle上设置了它:http://jsfiddle.net/2EHkp/

我觉得这与我定位<p>段落而不是href有关。但我无法弄清楚如何定位href而不是<p>。有人可以告诉我我做错了吗?

5 个答案:

答案 0 :(得分:3)

.single_box a {text-decoration:none;}

答案 1 :(得分:1)

您需要选择锚点。而不是容器。 http://jsfiddle.net/2EHkp/1/

.single_box a {text-decoration:none;}

这就是您所拥有的:

.single_box  {text-decoration:none;}

答案 2 :(得分:1)

文本修饰默认为链接加下划线。所以,你需要关闭它:

.single_box a {
    text-decoration: none;
}

答案 3 :(得分:0)

以href为目标,您可能需要:

.single_box a{text-decoration:none;}

答案 4 :(得分:0)

如果你没有使用像text-decoration这样的任何css,那么默认情况下锚点链接会显示下划线:无;

请在.single_box类

下添加一个额外的课程

这是我的代码:

.single_box a{text-decoration:none;}
相关问题