Challenge - 5 Problems
CSS File Organization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2: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?
Attempts:
2 left
💡 Hint
Think about how organizing your clothes in different drawers helps you find them faster.
✗ Incorrect
Splitting CSS into multiple files helps keep styles organized by components or features, making it easier to maintain and update the code.
📝 Syntax
intermediate2: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 */Attempts:
2 left
💡 Hint
Think about how you include styles inside CSS files, not HTML tags.
✗ Incorrect
The correct syntax to import CSS inside another CSS file is @import url('filename.css');
❓ layout
advanced2: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?
<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?
Attempts:
2 left
💡 Hint
Later styles in CSS files override earlier ones if selectors have the same specificity.
✗ Incorrect
CSS rules loaded later override earlier ones if they have the same specificity. Since theme.css is loaded after base.css, its styles take precedence.
❓ accessibility
advanced2:00remaining
Organizing CSS for accessibility
Which CSS file organization approach best supports accessibility improvements?
Attempts:
2 left
💡 Hint
Think about how having a special drawer for important tools helps you find them quickly.
✗ Incorrect
Having a dedicated CSS file for accessibility styles helps developers easily find and update those styles, improving maintainability and accessibility.
❓ selector
expert2:00remaining
Specificity and file organization impact
You have two CSS files:
1. components.css with selector
2. overrides.css with selector
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?
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?
Attempts:
2 left
💡 Hint
More specific selectors override less specific ones if loaded later.
✗ Incorrect
The selector button.btn is more specific than .btn alone, and since overrides.css is loaded after components.css, the button text will be red.