I know we can do this in CSS:
div.className p
{
/* some style*/
}
But how can we do
div.className p span
{
/* some style */
}
to refer to the span in HTML like this:
<div class='className'>
<p> <span> Some text </span> </p>
</div>
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.
There’s technically nothing wrong with your selector. I would recommend not including the tag name when it isn’t necessary though, as described by the Google HTML/CSS Style Guide.
It’s easy to get a grip on how selectors work by inspecting elements with Chrome’s inspector. A full selector path is provided, like this: