What does specificity refer to in CSS?
A). A. The order of styles in the style sheet.
B). B. The process of applying styles to HTML elements.
C). C. The priority given to CSS rules when multiple rules target the same element.
D). D. The size of CSS files.
Which of the following CSS selectors has the highest specificity?
A). A. div
B). B. .container
C). C. #header
D). D. body
How does the cascade resolve conflicts between CSS styles?
A). A. By applying styles in the order they appear in the style sheet.
B). B. By giving priority to styles with higher specificity.
C). C. By ignoring conflicting styles.
D). D. By randomly selecting styles.
Which CSS selector has the lowest specificity?
A). A. ID selectors
B). B. Class selectors
C). C. Inline styles
D). D. Element selectors
Which of the following has the highest specificity in CSS?
A). A. Class selectors
B). B. ID selectors
C). C. Element selectors
D). D. Inline styles
When should the !important declaration be used in CSS?
A). A. Always, to ensure styles are applied consistently.
B). B. Sparingly, as it can lead to difficulties in maintaining styles.
C). C. Never, as it is deprecated in modern CSS.
D). D. Only when overriding browser default styles.
Which selector has higher specificity, an ID selector or a class selector?
A). A. ID selector
B). B. Class selector
C). C. They have equal specificity.
D). D. It depends on the specific use case.
What happens if conflicting styles have the same specificity in CSS?
A). A. The browser applies both styles.
B). B. The browser applies the style declared first in the style sheet.
C). C. The browser applies the style declared last in the style sheet.
D). D. The browser ignores both styles.
What happens if conflicting styles have the same specificity and order in the style sheet?
A). A. The browser applies the style declared first.
B). B. The browser applies the style declared last.
C). C. The browser applies both styles.
D). D. The browser ignores both styles.
What is the purpose of the !important declaration in CSS?
A). A. To indicate important styles for accessibility.
B). B. To improve page loading performance.
C). C. To override inline styles.
D). D. To give a style the highest priority.