Combining selector sequences into @extend in SASS
If we need to combine selector sequences, we also use the @extend directive:
Let's consider the following example:
#main .list p {
font-weight: bold;
}
#sub .resume .link {
@extend p;
}
Note in the compiled code in the css file that when combining two sequences that do not have common selectors, new selectors are automatically generated: one with the first sequence before the second, and one with the second sequence before the first:
#main .list p,
#main .list #sub .resume .link, #sub .resume #main .list .link {
font-weight: bold;
}
In case the sequences have a common selector, they will be merged together and only the differences (if any) will be alternated. In the following example, both sequences have the identifier #main:
#main .list p {
font-weight: semi-bold;
}
#main .resume .link {
@extend p;
}
As a result of compilation, these two identifiers will be combined:
#main .list p,
#main .list #sub .resume .link, #sub .resume #main .list .link {
font-weight: bold;
}
Tell me what the result of compiling the following code will be:
div p {
font-size: 12px;
padding-bottom: 4px;
}
link button #card-title {
@extend p;
}