CSS Questions & Answers – Specificity and Importance

This set of CSS Multiple Choice Questions & Answers (MCQs) focuses on “Specificity and Importance”.

Find the specificity of the statments using the rule given below.
A selector’s specificity is calculated as follows:
1) count 1 if the declaration is from is a ‘style’ attribute rather than a rule with a selector, 0 otherwise (= a) (In HTML, values of an element’s “style” attribute are style sheet rules. These rules have no selectors, so a=1, b=0, c=0, and d=0.)
2) count the number of ID attributes in the selector (= b)
3) count the number of other attributes and pseudo-classes in the selector (= c)
4) count the number of element names and pseudo-elements in the selector (= d)

1. Find the specificity of this “*”.
a) specificity = 0,0,0,0
b) specificity = 0,0,0,1
c) specificity = 0,0,1,0
d) specificity = 1,0,0,0
View Answer

Answer: a
Explanation: Self-explainatory.

2. Find the specificity of this “li”.
a) specificity = 0,0,0,1
b) specificity = 0,0,1,1
c) specificity = 0,1,1,1
d) specificity = 1,1,1,1
View Answer

Answer: a
Explanation: Self-explainatory.
advertisement
advertisement

3. Find the specificity of this ” ul li”.
a) specificity = 0,0,0,0
b) specificity = 0,0,1,2
c) specificity = 0,0,0,2
d) specificity = 2,0,0,0
View Answer

Answer: c
Explanation: Self-explainatory.

4. Find the specificity of this “li:first-line”.
a) specificity = 0,0,1,1
b) specificity = 0,0,0,2
c) specificity = 0,1,0,1
d) specificity = 1,0,0,1
View Answer

Answer: b
Explanation: Self-explainatory.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

5. Find the specificity of this “ul ol+li”.
a) specificity = 0,0,2,1
b) specificity = 0,2,1,1
c) specificity = 0,1,1,1
d) specificity = 0,0,0,3
View Answer

Answer: d
Explanation: Self-explainatory.

6. Find the specificity of this “ul ol li.red”.
a) specificity = 0,0,3,1
b) specificity = 0,0,1,3
c) specificity = 1,1,1,1
d) specificity = 1,2,2,1
View Answer

Answer: b
Explanation: Self-explainatory.
advertisement

7. Find the specificity of this “ul ol li.red”.
a) specificity = 0,0,1,3
b) specificity = 0,0,0,4
c) specificity = 0,1,2,1
d) specificity = 1,1,1,1
View Answer

Answer: a
Explanation: Self-explainatory.

8. Find the specificity of this “li.red.leve”.
a) specificity = 2,0,0,1
b) specificity = 0,0,1,1
c) specificity = 0,2,0,1
d) specificity = 0,0,2,1
View Answer

Answer: d
Explanation: Self-explainatory.
advertisement

9. Find the specificity of this “#x34y”.
a) specificity = 0,0,0,1
b) specificity = 0,0,1,0
c) specificity = 0,1,0,0
d) specificity = 1,0,0,0
View Answer

Answer: c
Explanation: Self-explainatory.

10. Find the specificity of this ” style=”” “.
a) specificity = 0,0,0,1
b) specificity = 0,0,1,0
c) specificity = 0,1,0,0
d) specificity = 1,0,0,0
View Answer

Answer: d
Explanation: Self-explainatory.

Sanfoundry Global Education & Learning Series – CSS.

To practice all areas of CSS, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.