.warning {
background: #ffc;
border-color: #fc0; }
Here,too,ourextendedandextendeeselectorsaregroupedtogetherinasinglerule
set.SassalsosupportsextendingIDselectors.Todate,however,there’snosupport
forextendingmorecomplexselectorssuchas#sidebar > h3orp span.
Wecanalsoextendpseudo-classes,althoughSass’shandlingisalittlebitcounter-
intuitive.ConsiderthefollowingSasscode:
tr:nth-child(even) {
background: #eee;
}
th {
@extend tr;
border: 1px solid #000;
font: 11px / 1.5 sans-serif;
}
YoumightexpecttheCSSoutputtolooklikethisexamplewithselectorscombined
inoneline:
tr:nth-child(even),
th {
background: #eee;
}
Whatfollowsistheactualoutput:
tr:nth-child(even), th:nth-child(even) {
background: #eee;
}
Whenextendingaselectorthatconsistsofaclassorelementandapseudo-class,
Sasswillalsoaddthepseudo-classtotheextendedselector’sparent.
348 CSS Master