Penggabungan Pseudo-class dalam LESS
Ampersand (&) mudah digunakan saat bekerja dengan pseudo-class. Lihat contoh:
a {
color: blue;
&:hover {
color: red;
}
}
Hasil kompilasi:
a {
color: blue;
}
a:hover {
color: red;
}
Jelaskan, bagaimana hasil kompilasi dari kode berikut:
a.class {
&:link {
color: red;
}
&:visited {
color: blue;
}
&:hover {
color: green;
}
}
Sederhanakan kode yang diberikan:
#block {
width: 300px;
}
#block a:link, #block a:visited {
color: red;
}
#block a:hover {
color: blue;
}