[英]how to style a tel link with different colors on different pages css
I currently have a tel link on my site:我目前在我的网站上有一个电话链接:
HTML HTML
Give us a call today on <a href="tel:+441234123456">01234123456</a>
CSS CSS
a[href^="tel:"] {
font-size:12px;
font-color:white;
}
The only problem is that on another page I have the telephone number showing as part of some text and I need to show the tel number on this page in black and I am not sure how I override this?唯一的问题是,在另一个页面上,我将电话号码显示为某些文本的一部分,我需要在此页面上以黑色显示电话号码,但我不确定如何覆盖它?
Any ideas?有什么想法吗?
Use color:
attribute instead of font-color:
.使用color:
属性而不是font-color:
。
I would go like this :我会这样:
a {
font-size:12px;
color: #FFF;
}
You should give a class to your a
tag, like this :你应该给你a
标签一个类,像这样:
<a class="phone-number">+4412666666</a>
in order to assign a color to this specific class, like this :为了给这个特定的类分配一种颜色,像这样:
a.phone-number {
font-size:12px;
color: #FFF;
}
Good luck !祝你好运!
Simple answer: add an specific class to this phone container.简单的回答:向这个电话容器添加一个特定的类。
<a class="phone-green" href="tel:+441234123456">01234123456</a>
Then add a class modifier in css file:然后在css文件中添加一个类修饰符:
a[href^="tel:"].phone-green {
font-size: 12px;
color: white;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.