同一 HTML 页面上的不同颜色链接 [英] Different Color Links on the Same HTML Page

查看:28
本文介绍了同一 HTML 页面上的不同颜色链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试在同一页面上使用不同颜色的链接.我希望一些链接是蓝色的,一些链接是黑色的.我是 html 和 CSS 的新手,所以提前谢谢你!

Hi I am trying to have different color links on the same page. I want some links to be blue and some links to be black. I am new to html and CSS so thank you in advance!

-斯宾塞

推荐答案

CSS:

a.class1 {color:red;}
a.class1:link  {text-decoration: none; color: red;}
a.class1:visited {text-decoration: none; color: red;}
a.class1:hover {text-decoration: underline; color: red;}
a.class1:active {text-decoration: none; color: red;}


a.class2 {color:blue;}
a.class2:link {text-decoration: none; color: blue;}
a.class2:visited {text-decoration: none; color: blue;}
a.class2:hover {text-decoration: underline; color: blue;}
a.class2:active {text-decoration: none; color: blue;}

HTML:

<a href="http://www.google.com" class="class1">Google</a>
<a href="http://stackoverflow.com" class="class2">Stackoverflow</a>

演示:https://jsfiddle.net/3L4xguj7/

2021 年 5 月 16 日更新:更新链接

这篇关于同一 HTML 页面上的不同颜色链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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