Pseudo-classes biasanya digunakan untuk menambahkan spesial efek untuk beberapa selektor di dalam pengkodean CSS.
Syntax pseudo-classes:
selector:pseudo-class {property:value;}
CSS classes dapat juga digunakan pd pseudo-classes:
selector.class:pseudo-class {property:value;}
Contoh :
Contoh dihalaman htm :
selector:pseudo-class {property:value;}
CSS classes dapat juga digunakan pd pseudo-classes:
selector.class:pseudo-class {property:value;}
Contoh :
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 */
Contoh dihalaman htm :
Coba tekan
Catatan: a:hover Sebelum link tsb kita klik
Catatan: a:active Efektif ketika kita klik link tsb
Pseudo-classes dapat dikombinasikan dgn CSS classes:
a.red:visited {color:#FF0000;}
CSS Syntax
Jika link tsb dikunjungi maka link yg terlihat akan berwarna merah
Pseudo-classes Property
Property
|
Description
|
CSS
|
:active
|
Adds a style to an element that is activated
|
1
|
:first-child
|
Adds a style to an element that is the first child of another element
|
2
|
:focus
|
Adds a style to an element that has keyboard input focus
|
2
|
:hover
|
Adds a style to an element when you mouse over it
|
1
|
:lang
|
Adds a style to an element with a specific lang attribute
|
2
|
:link
|
Adds a style to an unvisited link
|
1
|
:visited
|
Adds a style to a visited link
|
1
|
Sumber : w3schools.com
0 komentar:
Posting Komentar