伪类选择器小实例

伪类选择器的分类

链接伪类选择器:
E:link
E:visited

用户行为选择器:
E:hover
E:active
E:focus

语言伪类选择器:E:lang(fr)

否定伪类选择器:E:not(s)

结构性伪类选择器:
E:root
E:first-child
E:last-child
E:only-child
E:nth-child(n)
E:nth-last-child(n)
E:first-of-type
E:last-of-type
E:only-of-type
E:nth-of-type(n)
E:nth-last-of-type(n)
E:empty

用户界面(UI)元素状态伪类选择器:
E:checked
E:enabled
E:disabled

目标伪类选择器:E:target

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			/* E:link */
			/* 设置超链接a在未被访问前的样式。 */
			a:link {
				text-decoration: none;
				color: blue;
			}

			/* E:visited */
			/* 设置超链接a在其链接地址已被访问过时的样式。 */
			a:visited {
				text-decoration: none;
				color: purple;
			}

			/* E:hover */
			/* 设置元素在其鼠标悬停时的样式。 */
			a:hover {
				text-decoration: none;
				color: red;
			}

			/* E:active */
			/* 设置元素在被用户激活(在鼠标点击与释放之间发生的事件)时的样式。 */
			a:active {
				text-decoration: none;
				color: yellow;
			}

			/* a:hover 必须位于 a:link 和 a:visited 之后
			a:active 必须位于 a:hover 之后 */

			/* E:focus */
			/* 设置对象在成为输入焦点(该对象的onfocus事件发生)时的样式。 */
			input:focus {
				background: #f6f6f6;
				color: #f60;
				border: 1px solid #f60;
			}

			/* E:lang(fr) */
			/* 匹配使用特殊语言的E元素。 */
			p:lang(zh-cmn-Hans) {
				color: #f00;
			}

			p:lang(en) {
				c
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值