【发布时间】:2013-10-22 04:50:57
【问题描述】:
我有一个 div,我想在其中覆盖我的全局链接样式。我有两种链接样式,一种是全局的,一种是特定的。代码如下:
A:link {text-decoration: none; color: #FF0000;}
A:visited {text-decoration: none; color: #FF0000;}
A:hover {text-decoration: none; color: #FF0000;}
A:active {text-decoration: none; color: #FF0000;}
#macrosectiontext
{
position:relative;
font:Arial, sans-serif;
text-align:center;
font-size:50px;
font-style: bold;
margin-top:245px;
opacity: 0.6;
background-color:transparent;
}
#macrosectiontext A:link {text-decoration: none; color: #000000;}
#macrosectiontext A:visited {text-decoration: none; color: #FFFFFF;}
#macrosectiontext A:hover {text-decoration: none; color: #FFFFFF;}
#macrosectiontext A:active {text-decoration: none; color: #FFFFFF;}
我像这样使用 div:
<div id="macrosectiontext"><a href="www.google.it">bla bla bla</a></div>
但它似乎不起作用。 div 仍然继承全局链接样式。
【问题讨论】:
-
我在您的 HTML 中没有看到锚链接
-
只要写
#macrosectiontext a {color:#000000};就行了 -
对我来说很好。这是jsfiddle。
-
@Paulie_D:我忘记添加锚链接了……在这里
-
是的,上面提到的 JSFiddle 似乎证实它应该可以工作。也许你在某个地方有拼写错误?
标签: css html hyperlink stylesheet