CSS 样式特定链接 [英] CSS Style a specific link

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

问题描述

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

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.

问题:所有更多"链接都需要使用 11pt 字体,而正文使用 12pt.有没有办法指定如果链接更多",它将在 11pt 中设置样式?

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 样式特定链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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