css教程:CSS偽類_CSS教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
CSS pseudo-classes are used to add special effects to some selectors.
CSS偽類可用來給一些選擇器加上非凡效果。
Hyperlink
如何在文檔內給超級連接加上不同的顏色
This example demonstrates how to add different colors to a hyperlink in a document.
Examples 實例:
[ 可先修改部分代碼 再運行查看效果 ]
Hyperlink 2
如何給超級連接加上其他樣式
This example demonstrates how to add other styles to hyperlinks.
Examples 實例:
[ 可先修改部分代碼 再運行查看效果 ]
The syntax of pseudo-classes:
偽類語法:
CSS classes can also be used with pseudo-classes:
類也可以使用偽類:
錨點偽類 Anchor Pseudo-classes
A link that is active, visited, unvisited, or when you mouse over a link can all be displayed in different ways in a CSS-supporting browser:
當一個連接處于 活動,被訪問,未訪問或是當你鼠標移動到上面的時候都可以給它以不同的方式來表現(xiàn),前提是瀏覽器支持CSS:
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!
注重 a:hover 必須在a:link和 a:visited后出現(xiàn),要有順序才能正常顯示效果!
Note: a:active MUST come after a:hover in the CSS definition in order to be effective!!
注重: CSS中a:active必須出現(xiàn)在a:hover定義后才能有效果!
Pseudo-classes and CSS Classes
偽類和CSS類
Pseudo-classes can be combined with CSS classes:
偽類可以與CSS類組合使用:
If the link in the example above has been visited, it will be displayed in red.
假如上面的連接已經(jīng)被訪問過了,它就會顯示為紅色。
CSS偽類可用來給一些選擇器加上非凡效果。
Hyperlink
如何在文檔內給超級連接加上不同的顏色
This example demonstrates how to add different colors to a hyperlink in a document.
Examples 實例:
代碼調試框 [www.hl5o.cn]
[ 可先修改部分代碼 再運行查看效果 ]
Hyperlink 2
如何給超級連接加上其他樣式
This example demonstrates how to add other styles to hyperlinks.
Examples 實例:
代碼調試框 [www.hl5o.cn]
[ 可先修改部分代碼 再運行查看效果 ]
The syntax of pseudo-classes:
偽類語法:
示例代碼 [www.hl5o.cn]
selector:pseudo-class {property: value}
CSS classes can also be used with pseudo-classes:
類也可以使用偽類:
示例代碼 [www.hl5o.cn]
selector.class:pseudo-class {property: value}
錨點偽類 Anchor Pseudo-classes
A link that is active, visited, unvisited, or when you mouse over a link can all be displayed in different ways in a CSS-supporting browser:
當一個連接處于 活動,被訪問,未訪問或是當你鼠標移動到上面的時候都可以給它以不同的方式來表現(xiàn),前提是瀏覽器支持CSS:
示例代碼 [www.hl5o.cn]
a:link {color: #FF0000} /* unvisited link */
a:visited {color: #00FF00} /* visited link */
a:hover {color: #FF00FF} /* mouse over link */
a:active {color: #0000FF} /* selected link */
a:visited {color: #00FF00} /* visited link */
a:hover {color: #FF00FF} /* mouse over link */
a:active {color: #0000FF} /* selected link */
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!
注重 a:hover 必須在a:link和 a:visited后出現(xiàn),要有順序才能正常顯示效果!
Note: a:active MUST come after a:hover in the CSS definition in order to be effective!!
注重: CSS中a:active必須出現(xiàn)在a:hover定義后才能有效果!
Pseudo-classes and CSS Classes
偽類和CSS類
Pseudo-classes can be combined with CSS classes:
偽類可以與CSS類組合使用:
示例代碼 [www.hl5o.cn]
a.red:visited {color: #FF0000}
<a class="red" href="http://www.hl5o.cn/">CSS Syntax</a>
<a class="red" href="http://www.hl5o.cn/">CSS Syntax</a>
If the link in the example above has been visited, it will be displayed in red.
假如上面的連接已經(jīng)被訪問過了,它就會顯示為紅色。
相關CSS教程:
- 相關鏈接:
- 教程說明:
CSS教程-css教程:CSS偽類
。