[英]CSS Styling for 'a' (anchor tag) is not working
Let's say I have some hyperlink but class and id of it are already used by other scripts. 假设我有一些超链接,但其他脚本已经使用了它的类和ID。 So how can I add some css to them ?
那么,如何为它们添加一些CSS? I tried 2 things.
我尝试了2件事。
<div class='some_css'>
<a href='".$_SERVER['PHP_SELF']."' class='used' id='used1'>link1</a>
<a href='".$_SERVER['PHP_SELF']."' class='used' id='used2'>link2</a>
</div>
///css file
.some_css:a
{
color:#456e9c;
}
Another try 再试一次
<span class='some_css'><a href='".$_SERVER['PHP_SELF']."' class='used' id='used1'>link1</a></span>
<span class='some_css'><a href='".$_SERVER['PHP_SELF']."' class='used' id='used2'>link2</a></span>
///css file
.some_css:a
{
color:#456e9c;
}
Both are wrong..... I know I do something wrong, please help 都错了.....我知道我做错了,请帮忙
Use a space, not a colon ( :
). 使用空间,而不是一个冒号(
:
)。 Colons are meant for stuff like pseudo-classes/elements, and properties. 冒号用于伪类/元素和属性之类的东西。
.some_css a
{
color:#456e9c;
}
用空格替换冒号(':')。
.some_css a {
}
(in other words, lose the ':') (换句话说,丢失“:”)
Target a contained inside .some_css 定位.some_css中包含的
.some_css a {
color:#456e9c;
}
a href='".$_SERVER['PHP_SELF']."' class='used other_class' id='used1'>link1</a>
因此,您可以使用空格作为分隔符来为一个元素定义多个类...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.