閱讀書籍:CSS: The Missing Manual

Pseudo-Classes and Pseudo-Elements

1
2
3
4
5
6
/* Pseudo-Classes 在CSS3是用一個分號來表示 */
a:link /* 使用者還沒點擊過的連結 */
a:visited /* 使用者點擊過的連結 */
a:hover /* 使用者滑鼠移上去的連結 */
a:active /* 使用者正在點擊的連結 */
input:focus /* 使用者正在對input做編輯 */
1
2
3
4
5
6
/* Pseudo-Elements 在CSS3是用兩個分號來表示 */
p::first-letter /* 段落的第一個文字的樣式 */
p::first-line /* 段落的第一行文字的樣式 */
p::before
p::after /* before和after是可以插入content文字的Pseudo-Element而不用額外寫在HTML當中 */
::selection /* 使用者在畫面中選取起來的文字 */