0
0
HTMLmarkup~20 mins

Header, footer, main in HTML - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Semantic Layout Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
2:00remaining
What is the visual output of this HTML structure?
Consider this HTML code:
<header><h1>Welcome</h1></header>
<main><p>Main content here.</p></main>
<footer><p>Footer info</p></footer>

What will the browser display?
HTML
<header><h1>Welcome</h1></header>
<main><p>Main content here.</p></main>
<footer><p>Footer info</p></footer>
AOnly the footer paragraph 'Footer info' is visible.
BThe main content is hidden and only header and footer show.
CA page with a big heading 'Welcome' at top, a paragraph 'Main content here.' below it, and a footer paragraph 'Footer info' at the bottom.
DThe heading and footer are swapped in position visually.
Attempts:
2 left
💡 Hint
Think about the natural order of header, main, and footer in HTML.
🧠 Conceptual
intermediate
1:30remaining
Which semantic element is best for the main content?
You want to mark the main part of your webpage that holds the primary information. Which HTML element should you use?
A<main>
B<footer>
C<header>
D<section>
Attempts:
2 left
💡 Hint
The element should represent the main content unique to the page.
selector
advanced
1:30remaining
Which CSS selector targets only the footer element?
Given this HTML:
<header>...</header>
<main>...</main>
<footer>...</footer>

Which CSS selector will style only the footer?
Afooter
Bmain
Csection
Dheader
Attempts:
2 left
💡 Hint
The selector matches the element name you want to style.
layout
advanced
2:30remaining
How to keep footer at bottom of viewport if content is short?
You want the footer to always appear at the bottom of the browser window even if the main content is small. Which CSS approach works best?
ASet footer display to inline-block;
BSet footer position to fixed with bottom: 0;
CUse float: right on footer.
DUse flexbox on body with column direction and main to grow, footer at bottom.
Attempts:
2 left
💡 Hint
Think about a layout that stretches main content to fill space pushing footer down.
accessibility
expert
3:00remaining
Which ARIA role best describes the main content for screen readers?
You want to improve accessibility by explicitly marking the main content region for assistive technologies. Which ARIA role should you add to the <main> element?
Arole="banner"
Brole="main"
Crole="contentinfo"
Drole="navigation"
Attempts:
2 left
💡 Hint
The role should match the main content landmark.