CSS之伪类

1、:link
  语法:
Selector : link { sRules }
说明:
设置 a 对象在未被访问前的样式。
默认值由浏览器决定。
对于无 href 属性(特性)的 a 对象,此伪类不发生作用。
请参阅 body 对象的 link 属性(特性)和 document 对象的 linkColor 特性。
IE3将 :link 伪类的样式表属性作用于 visited 伪类。

示例:


a:link { font-size: 14pt; text-decoration: underline; color: blue; } 

 
2、:hover
  语法:
Selector : hover { sRules }
说明:
设置对象在其鼠标悬停时的样式。
在CSS1中此伪类仅可用于 a 对象。对于无 href 属性(特性)的 a 对象,此伪类不发生作用。
在CSS2中此伪类可以应用于任何对象。

示例:


a:hover { font-size: 14pt; text-decoration: underline; color: blue; }
a:hover span{ color:red; } 
 
3、:active
  语法:
Selector : active { sRules }
说明:
设置对象在被用户激活(在鼠标点击与释放之间发生的事件)时的样式。
在CSS1中此伪类仅可用于 a 对象。对于无 href 属性(特性)的 a 对象,此伪类不发生作用。
在CSS2中此伪类可以应用于任何对象。
并且 :active 可以和 :link 以及 :visited 状态同时发生。

示例:


a:active { font-size: 14pt; text-decoration: underline; color: blue; } 

 
4、:visited
  语法:
Selector : visited { sRules }
说明:
设置 a 对象在其链接地址已被访问过时的样式。
IE3将 :link 伪类的样式表属性作用于 :visited 伪类。
默认值由浏览器决定。定义网页过期时间或用户清空历史记录将影响此伪类的作用。
对于无 href 属性(特性)的 a 对象,此伪类不发生作用。
请参阅 body 对象的 vlink 属性(特性)和 document 对象的 vlinkColor 特性。

示例:


a:visited { font-size: 14pt; text-decoration: underline; color: blue; } 

 
5、:first-child
  语法:
Selector : first-child { sRules }
说明:
设置 E 的第一个子对象的样式。

示例:


p a:first-child { color: green }
table td:first-child { width:200px; } 

 
6、:first
  语法:
Selector : first { sRules }
说明:
设置页面容器第一页使用的样式。仅用于 @page 规则。

示例:


@page :first { margin: 4cm } 

 
7、:left
  语法:
Selector : left { sRules }
说明:
设置页面容器位于装订线左边的所有页面使用的样式。仅用于 @page 规则。


示例:


@page :left { margin: 4cm } 

 
8、:right
  语法:
Selector : right { sRules }
说明:
设置页面容器位于装订线右边的所有页面使用的样式。仅用于 @page 规则。

示例:


@page :right { margin: 4cm } 

 
9、:lang
  语法:
Selector : lang { sRules }
说明:
设置对象使用特殊语言的内容的样式。

示例:


blockquote:lang(fr) { quotes: '?' ' ?' }
/* 使用法语显示由quotes属性指定的法语的嵌套标记 */ 

 
10、:focus
  语法:
Selector : focus { sRules }
说明:
设置对象在成为输入焦点(该对象的 onfocus 事件发生)时的样式。

示例:


a:focus { font-size: 14pt; text-decoration: underline; color: blue; }
a:focus img { border: thin solid green } 

 

 
 

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/vince6799/archive/2007/12/18/1946201.aspx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值