CSS Style一个特定的链接 [英] CSS Style a specific link

查看:145
本文介绍了CSS Style一个特定的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景:我正在为我工​​作的公司创建网站。我需要按照他们的视觉风格指南,所以我创建一个CSS文件的网站。



问题:所有更多链接需要为11pt字体,而正文为12pt。是否有一种方法来指定如果链接是更多,它将在11pt中设置样式?



编辑:是否还有这样做而不使用类?

摘要:我需要对特定链接进行样式化,但我不想使用类来对它们进行样式化,

$

 < a href =whatever.htmlclass =more>更多< / a> 

CSS

  body {
font-size:12px;
}

a.more {
font-size:11px;
}


Scenario: I am in the process of creating a website for the company I work for. I need to follow their visual style guide so I'm creating a CSS file for the website.

Question: All the "more" links need to be in 11pt font while the body is in 12pt. Is there a way to specify that if the link is "more" that it will be styled in 11pt?

Edit: Is there anyway to do this without using a class? Based off the text instead?

Summary: I need to style specific links but I would not like to use classes to style them, maybe text instead?

解决方案

HTML

<a href="whatever.html" class="more">More</a>

CSS

body {
    font-size: 12px;
}

a.more {
    font-size: 11px;
}

这篇关于CSS Style一个特定的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆