I’m working on some CSS from a tutorial, a div has this class:
<div class="related products">
How can I reference it in the stylesheet?
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
divactually has two classes,relatedandproducts. You can reference it in your stylesheet with either.relatedor.products, and it will pick up the styles from both of those rules. For example, with the following CSS, the text in thedivin your question would appear red with font size 12:If you want to select elements with both classes, use
.related.productsin your stylesheet. For example, add the following to the above example:And the text in your
divwill receive all three rules, because it matches all 3 selectors. Here’s a working example.