Challenge - 5 Problems
Section Link Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
What happens when you click this link?
Given the HTML below, what will the browser do when the user clicks the link labeled Go to Section 2?
HTML
<nav> <a href="#section2">Go to Section 2</a> </nav> <main> <section id="section1"> <h2>Section 1</h2> <p>Welcome to section one.</p> </section> <section id="section2"> <h2>Section 2</h2> <p>This is the second section.</p> </section> </main>
Attempts:
2 left
💡 Hint
Look at the href attribute and the id attributes of the sections.
✗ Incorrect
The link's href="#section2" points to the element with id="section2". Clicking it scrolls the page to that section.
📝 Syntax
intermediate2:00remaining
Which anchor tag correctly links to the section with id="contact"?
Choose the correct anchor tag that links to the section with
id="contact".Attempts:
2 left
💡 Hint
Links to sections on the same page use a hash (#) followed by the id.
✗ Incorrect
To link to a section on the same page, the href must start with # followed by the exact id value.
❓ selector
advanced2:00remaining
Which CSS selector targets the section linked by
<a href="#about">?You have a link
<a href="#about">About</a>. Which CSS selector will style the section it links to?Attempts:
2 left
💡 Hint
The link points to an element with id="about". How do you select an element by id?
✗ Incorrect
The section with id="about" is selected by the CSS selector section#about. The other options select links or invalid attributes.
❓ layout
advanced2:00remaining
How to keep the linked section visible below a fixed header?
You have a fixed header 60px tall. When clicking a link to a section with an ID, the section's top is hidden behind the header. How can you fix this so the section content is fully visible below the header?
Attempts:
2 left
💡 Hint
Think about shifting the section content down without changing layout flow.
✗ Incorrect
Adding padding-top equal to header height and negative margin-top of same size shifts the section content down so it is visible below the fixed header.
❓ accessibility
expert2:00remaining
What ARIA attribute improves accessibility for links to page sections?
When linking to a section on the same page using an anchor with href="#sectionID", which ARIA attribute helps screen readers understand the link's purpose better?
Attempts:
2 left
💡 Hint
Think about how to describe the link clearly for screen readers.
✗ Incorrect
Using aria-label provides a clear description of the link's purpose, helping screen reader users understand it links to a specific section.