日期:2014-05-17  浏览次数:20789 次

CSS 伪类

个人认识:css伪类即对某个元素的不同状态提供表现控制。

a:link
 {color: #FF0000}	/* 未访问的链接 */

a:visited
 {color: #00FF00}	/* 已访问的链接 */

a:hover
 {color: #FF00FF}	/* 鼠标移动到链接上 */

a:active
 {color: #0000FF}	/* 选定的链接 */


这些是超链接的伪类

p:first-child 伪类的意思是作为副元素的第一个p元素,你的表现如何。

?

<html>
<head>
<style type="text/css">
p:first-child
 {
  color: red;
  } 
</style>
</head>

<body>
<p>some text</p>

<p>some text</p>
</body>
</html>
  
匹配第一个p元素! 


:lang伪类 为不同语言定义样式。

<html>
<head>

<style type="text/css">
q:lang(no)
   {
   quotes: "~" "~"
   }

</style>

</head>

<body>
<p>文字<q lang="no"
>段落中的引用的文字</q>文字</p>

为名为no的语言定义引号。
</body></html>