演示效果
代码举例
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Css3动态伪类</title> <style> a { text-decoration: none; } a:link { color: green; } a:hover { color:yellow; } a:active { color:red; } a:visited { color:fuchsia; } input:focus { background: aqua; } </style> </head> <body> <a href="#">动态伪类</a> <input type="text"> </body> </html>
代码解释
link > A链接默认颜色
hover > 鼠标移动到链接颜色
active > 鼠标按住不放状态颜色
visited > 访问过后颜色
focus > 用作于input获取光标时候背景颜色
评论