0
0
CSSmarkup~20 mins

CSS file organization - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
CSS File Organization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why use multiple CSS files in a project?
Which of the following is the main reason to split CSS into multiple files in a large web project?
ATo make the website load slower by adding more HTTP requests
BTo organize styles by components or features for easier maintenance
CTo confuse developers by scattering styles across many files
DTo prevent styles from applying to any HTML elements
Attempts:
2 left
💡 Hint
Think about how organizing your clothes in different drawers helps you find them faster.
📝 Syntax
intermediate
2:00remaining
Correct way to import CSS files
Which CSS code correctly imports another CSS file named "buttons.css" inside "styles.css"?
CSS
/* Inside styles.css */
Ainclude 'buttons.css';
Bimport 'buttons.css';
C@import url('buttons.css');
Dlink rel='stylesheet' href='buttons.css';
Attempts:
2 left
💡 Hint
Think about how you include styles inside CSS files, not HTML tags.
layout
advanced
2:00remaining
Effect of CSS file order on layout
Given two CSS files loaded in this order in HTML:

<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="theme.css">

If both files style the same element, which file's styles will apply?
AStyles from theme.css will override base.css
BStyles from base.css will override theme.css
CBoth styles will apply equally causing a conflict
DNeither style will apply because of conflict
Attempts:
2 left
💡 Hint
Later styles in CSS files override earlier ones if selectors have the same specificity.
accessibility
advanced
2:00remaining
Organizing CSS for accessibility
Which CSS file organization approach best supports accessibility improvements?
ASeparate a CSS file dedicated to accessibility styles like focus outlines and high contrast
BMix accessibility styles randomly with all other styles in one big file
CAvoid writing any accessibility styles in CSS
DPut accessibility styles only in inline styles inside HTML
Attempts:
2 left
💡 Hint
Think about how having a special drawer for important tools helps you find them quickly.
selector
expert
2:00remaining
Specificity and file organization impact
You have two CSS files:

1. components.css with selector .btn { color: blue; }
2. overrides.css with selector button.btn { color: red; }

Both files are loaded in this order:
<link rel="stylesheet" href="components.css">
<link rel="stylesheet" href="overrides.css">

What color will a <button class="btn"> show?
ARed, because components.css styles are ignored
BBlue, because components.css is loaded first
CBlue, because .btn selector is more specific than button.btn
DRed, because overrides.css has a more specific selector and is loaded last
Attempts:
2 left
💡 Hint
More specific selectors override less specific ones if loaded later.