提示:怎么在a超链接里面用伪类选择器。
1、语法:
a{
color:#333;
text-decoration:none;
}
a:hover{
color:#369;
text-decoration:underline;
}
注意:
1、为了确保生效,请按照LAHA顺序声明:
link-:visited-:hover-:active
2、记忆法:
love hate或lv包包hao;
3、因为a链接在浏览器中具有默认样式,所以我们实际工作中需要单独指定样式。
自己代码展示:
<!--
* @Author: error: git config user.name && git config user.email & please set dead value or install git
* @Date: 2022-05-31 14:34:32
* @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
* @LastEditTime: 2022-08-21 19:45:17
* @FilePath: \code\前端代码\css学习知识\1.1什么是复合选择器\1.6链接伪类选择器.html
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>链接伪类选择器、常用的</title>
<style>
a {
color: #333;
text-decoration: none;
}
a:hover {
/* 当我们鼠标经过a超链接时候 */
color: aqua;
/* 颜色 */
text-decoration: underline;
/* a超链接下划线 */
}
</style>
</head>
<body>
<a href="#">小猪佩奇</a>
</body>
</html>
显示结果:
总结
提示:这里对文章进行总结:
例如:以上就是今天要讲的内容,本文仅仅简单介绍了怎么在a超链接里面用伪类选择器、鼠标经过颜色变化。