I am a newbie to CSS and SCSS.
In the following code,
.title {
width: 718px;
&.sub-title {
width: 938px;
}
}
What does &. means? Is it same as nesting class?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
&concatenates the parent class, resulting in.title.sub-title(rather than.title .sub-titleif the&is omitted).The result is that with the
&it matches an element with bothtitleandsub-titleclasses:whilst without the
&it would match a descendent with classsub-titleof an element with classtitle: