1D0-61B practice question 1 of 15
Which choice describes a correct order of precedence for implementing CSS?
Full set: 55 questionsThe CSS cascade determines which style rule applies when multiple rules conflict. The order of precedence, from lowest to highest, is generally: browser default styles, external style sheets, internal (embedded) style sheets, and finally inline styles. Inline styles are applied directly to an HTML element using the style attribute. Due to their high specificity, they will override any conflicting rules defined in internal or external style sheets. This makes them the most powerful styling method in the cascade, aside from the !important declaration.
B. External styles override all other styles. This is incorrect. Both internal (embedded) and inline styles have a higher precedence than external styles in the CSS cascade.
C. Internal (embedded) styles override inline styles. This is incorrect. Inline styles are more specific and therefore have a higher precedence than internal styles.
D. External styles override internal (embedded) styles. This is incorrect. When selectors have equal specificity, the rule that appears last wins. Typically, internal styles are defined after external sheets, giving them precedence.
1. World Wide Web Consortium (W3C). CSS Cascading and Inheritance Level 5, Section 6: Cascading. W3C Working Draft, 4 August 2022. This specification details the cascade algorithm, where inline styles are given the highest specificity. It states, "The declarations from a style attribute... are cascaded as if they were inside a style rule with a specificity of (1, 0, 0, 0)". This specificity is higher than any selector in an external or internal sheet can achieve.
Reference: https://www.w3.org/TR/css-cascade-5/#cascading (See Section 6.1. Cascade Sort Criteria and 6.2. Cascading Origins).
2. MDN Web Docs. Cascade and inheritance. Mozilla. This document explains the three main factors of the CSS cascade: importance, specificity, and source order. It explicitly states, "Inline styles... always overwrite any styles in external stylesheets, and thus can be thought of as having the highest specificity."
Reference: https://developer.mozilla.org/en-US/docs/Learn/CSS/Buildingblocks/Cascadeandinheritance (See the "Specificity" section).
3. Massachusetts Institute of Technology (MIT) OpenCourseWare. 6.170 Software Studio, Lecture 3: HTML & CSS. Fall 2005. The lecture slides on CSS rule precedence clearly list the hierarchy from lowest to highest as: Browser default, External style sheet, Internal style sheet, and Inline style.
Reference: https://ocw.mit.edu/courses/6-170-software-studio-spring-2005/resources/lec3/ (See slide 24, "CSS Rule Precedence").
Keep practicing
Take the free 1D0-61B practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 1D0-61B practice questions
- Question 2Which choice lists the HTML5 elements that define the document structure for a Web page?
- Question 3Which Web-based validation tool is used to validate Cascading Style Sheets (CSS)?
- Question 4You have been asked to design and develop a Web site for a retirement community. What can…
- Question 5Which line of code instructs the browser to look for a directory named mysite that begins…
- Question 6You need to center and indent a quote on your Web page. Which is the best way to accompli…
- Question 7You are developing a Web site in HTML5. You want the new HTML5 structural elements (such …
