我有一个div,我想覆盖我的全局链接样式。我有两种链接样式,一种是全球的,一种是特定的。下面的代码:覆盖HTML 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 {color:#000000};'这将起作用 –
对我来说工作正常。这是一个[jsfiddle](http://jsfiddle.net/Xz8KQ/)。 –