Challenge - 5 Problems
CSS Linking Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate2:00remaining
What is the correct way to link an external CSS file in HTML?
Choose the option that correctly links a CSS file named
styles.css in the HTML <head> section.CSS
<head> <!-- Link CSS here --> </head>
Attempts:
2 left
💡 Hint
The
<link> tag is used for external CSS files and needs a relationship attribute.✗ Incorrect
The
<link> tag with rel="stylesheet" and href="filename.css" correctly links an external CSS file. The <style> tag is for internal CSS, and <script> is for JavaScript files.🧠 Conceptual
intermediate2:00remaining
What happens if you use the wrong attribute to link CSS?
If you write
<link href="styles.css" rel="script"> in your HTML, what will happen?CSS
<head> <link href="styles.css" rel="script"> </head>
Attempts:
2 left
💡 Hint
The
rel attribute tells the browser what kind of file it is.✗ Incorrect
Using
rel="script" tells the browser the linked file is a script, not a stylesheet. Since the file is CSS, the browser ignores it and styles won't apply.❓ rendering
advanced2:00remaining
What visual result will this HTML and CSS produce?
Given the HTML and CSS below, what color will the paragraph text appear in the browser?
CSS
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="styles.css"> <title>Test</title> </head> <body> <p>Hello world!</p> </body> </html> /* styles.css content */ p { color: blue; }
Attempts:
2 left
💡 Hint
The CSS file sets the paragraph color to blue.
✗ Incorrect
The linked CSS file sets the
p element color to blue, so the paragraph text will appear blue in the browser.❓ selector
advanced2:00remaining
Which CSS selector will style only paragraphs inside a
<section>?You want to style only
<p> elements that are inside a <section> element. Which selector should you use in your CSS?Attempts:
2 left
💡 Hint
Think about the order and relationship between elements in selectors.
✗ Incorrect
The selector
section p targets all p elements inside any section, at any depth. Option B targets only direct children, which is more specific but not required here. Options B and D are reversed and invalid for this purpose.❓ accessibility
expert3:00remaining
How to ensure linked CSS does not reduce accessibility?
When linking an external CSS file, which practice helps maintain good accessibility for users with visual impairments?
Attempts:
2 left
💡 Hint
Accessibility means everyone can use your site easily, including those with vision challenges.
✗ Incorrect
Good accessibility means using high contrast colors so text is easy to read, not hiding content with CSS, and preserving semantic HTML and keyboard navigation. Options A, C, and D harm accessibility.