In the CSS cascade, which statement is true about inline styles?

Prepare for the CSS Mastery SAD Maintenance and CSA Stand Ups Test. With flashcards and multiple choice questions, ready yourself for the exam with hints and explanations for every question. Ace your exam today!

Multiple Choice

In the CSS cascade, which statement is true about inline styles?

Explanation:
Inline styles use the style attribute on an element, giving them the highest specificity of any author-created rule. That means they trump rules written in CSS files or style blocks, including those using ID selectors. When two declarations compete with equal specificity, the one that appears later in the cascade wins, and for inline styles that means the last inline declaration for a given property will apply. Inline styles can set any CSS property, not just fonts, so the claim that they apply only to font properties isn’t correct. (Note that an !important rule in a stylesheet can override a normal inline style, which is a useful exception to remember.)

Inline styles use the style attribute on an element, giving them the highest specificity of any author-created rule. That means they trump rules written in CSS files or style blocks, including those using ID selectors. When two declarations compete with equal specificity, the one that appears later in the cascade wins, and for inline styles that means the last inline declaration for a given property will apply. Inline styles can set any CSS property, not just fonts, so the claim that they apply only to font properties isn’t correct. (Note that an !important rule in a stylesheet can override a normal inline style, which is a useful exception to remember.)

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy