Are those CSS selectors do the same or there are differences?
div#myID { }
#myID div { }
If they are the same, which one is recommended?
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.
Well, they both do something different, so there is nothing to recommend.
div#myIDselects adivwith IDmyID. This can be expressed shorter with just#myID.#myID divselects alldivs that are descendants of the element with IDmyID.