html - HTML double links
问题描述
I have 2 sets of links on my html page, one for the top and bottom of the page, and one for different pages. But I want to change the second one. After I put this code
a:link {
color: green;
background-color: transparent;
text-decoration: none;
}
a:visited {
color: pink;
background-color: transparent;
text-decoration: none;
}
a:hover {
color: red;
background-color: transparent;
text-decoration: underline;
}
a:active {
color: yellow;
background-color: transparent;
text-decoration: underline;
}`
everything on my page becomes those colors. What can I do to change this?
解决方案
使用class
links 容器的属性来定义其中的链接的特殊样式。例如:
/* General link style */
a {
color: #0000FF;
}
/* Style for a link inside .special container */
.special a {
color: #00FF00;
}
<div>
<a href="#">Link A</a>
</div>
<div class="special">
<a href="#">Link B</a>
</div>
<div>
<a href="#">Link C</a>
</div>
推荐阅读
- r - t 在 R 中起作用。它不像看起来那样出来
- javascript - 有没有办法用javascript找到字符串来自哪个txt文件?
- php - AJAX:如何将动态创建的表行中的数据保存到数据库中?
- angular - 从 Angular 7 传递数据时,API 获取 0 httpRequest 文件计数
- java - 如何使用具有简单日志语句的 Spock 在 Java 中测试 catch 块
- git - Git 提交失败,因为需要 lint
- php - 如何从数据库中选择多个数据并将其分配到会话中?
- c# - 尝试更新其他属性时出现“无法修改属性 ID”错误
- windows - IIS 7 Windows Server 2012 中的 Kerberos 身份验证
- python - 如何在熊猫中按多索引分组