I'm attempting to override the link color in a certain area of an existing theme. The links are blue on a blue background by default. I'm not sure how this theme was approved to be offered to customers, but I'm going to attempt a simple fix by making links in this area white.
我试图覆盖现有主题的某个区域中的链接颜色。默认情况下,链接在蓝色背景上为蓝色。我不确定这个主题是如何被批准提供给客户的,但是我将尝试通过在这个区域中建立白色链接来进行简单的修复。
Here is the markup of the area of the page with the problem:
这是带有问题的页面区域的标记:
<div id="product_details_customtab2_tab">
<a href="http://www.example.com/">example</a>
</div>
Here was one of my unsuccessful fix attempts. I tried dozens of similar things. None worked.
这是我失败的修复尝试之一。我尝试了几十个类似的东西。没有用。
#product_details_customtab2_tab {link{color: white !important}}
However, the links in the area I wished to fix did not change. (There is an admin area where I can add custom CSS, so I inserted this there. I can make other styles in other areas of the theme change, so the basic functionality works, but in this specific case I don't have the details right.)
但是,我希望修复的区域中的链接没有改变。 (有一个管理区域我可以添加自定义CSS,所以我在那里插入。我可以在主题的其他区域更改其他样式,所以基本功能有效,但在这个特定情况下我没有详细信息对。)
What is wrong with my CSS? Have I given enough info in this question? Thanks
我的CSS出了什么问题?我在这个问题上给出了足够的信息吗?谢谢
UPDATE: Here's the solution that worked:
更新:这是有效的解决方案:
#product_details_customtab2_tab a:link{color: white}
Thank you!!!
2 个解决方案
#1
2
Your selector is wrong... there is no standalone CSS "link" selector, only the ":link" selector:
您的选择器是错误的...没有独立的CSS“链接”选择器,只有“:link”选择器:
http://www.w3schools.com/cssref/sel_link.asp
Also, to use CSS inheritance, you only need to separate each part of the inheritance chain with a space, not wrap it in {}. i.e., if you want to change all links inside a div with id "foo" you would do this:
此外,要使用CSS继承,您只需要使用空格分隔继承链的每个部分,而不是将其包装在{}中。即,如果你想改变id为“foo”的div中的所有链接,你会这样做:
#foo a { ... } /* CORRECT */
and NOT This:
而不是这个:
#foo { a { ... } } /* WRONG */
I assume that you either wanted to do this:
我假设你要么想要这样做:
#product_details_customtab2_tab a{color: white !important}
or this:
#product_details_customtab2_tab a:link{color: white !important}
#2
1
Your CSS is not valid. To make a selector inside another selector, you just need a space, like:
你的CSS无效。要在另一个选择器中创建一个选择器,您只需要一个空格,如:
#product_details_customtab2_tab a { color: white; }
This will select all a
elements inside that div.
这将选择该div中的所有元素。
#1
2
Your selector is wrong... there is no standalone CSS "link" selector, only the ":link" selector:
您的选择器是错误的...没有独立的CSS“链接”选择器,只有“:link”选择器:
http://www.w3schools.com/cssref/sel_link.asp
Also, to use CSS inheritance, you only need to separate each part of the inheritance chain with a space, not wrap it in {}. i.e., if you want to change all links inside a div with id "foo" you would do this:
此外,要使用CSS继承,您只需要使用空格分隔继承链的每个部分,而不是将其包装在{}中。即,如果你想改变id为“foo”的div中的所有链接,你会这样做:
#foo a { ... } /* CORRECT */
and NOT This:
而不是这个:
#foo { a { ... } } /* WRONG */
I assume that you either wanted to do this:
我假设你要么想要这样做:
#product_details_customtab2_tab a{color: white !important}
or this:
#product_details_customtab2_tab a:link{color: white !important}
#2
1
Your CSS is not valid. To make a selector inside another selector, you just need a space, like:
你的CSS无效。要在另一个选择器中创建一个选择器,您只需要一个空格,如:
#product_details_customtab2_tab a { color: white; }
This will select all a
elements inside that div.
这将选择该div中的所有元素。