Full-Stack course / Tools and the web
A nav bar with real interactive states
How to fetch and submit this exercise
Once: install the tool and connect your account.
curl -fsSL https://gonomicon.com/install.sh | sh
gonomicon loginEach exercise: download it, edit the file named in the instructions, then submit.
gonomicon fetch fs-week-1/05-05-interactive-nav-states
cd 05-05-interactive-nav-states
gonomicon submitA nav bar with real interactive states
Build a navigation bar with four links, clear hover and keyboard-focus states, and a visual marker for the current page.
Worked example: When a visitor hovers over a link or focuses it with a keyboard, its background changes; the current-page link has a marker before its text.
Rules and constraints
- Link
styles.cssfromindex.html. - Include a
<nav class="site-nav">containing a<ul>with at least four list items and links using the required classes. - Give one link the
site-nav__link--currentclass. - Organize the stylesheet into at least three comment-labeled sections and use a consistent
site-navblock naming pattern for classes. - Use a transition with a positive duration for the link’s background color or text color.
- The hover and keyboard-focus states must each have a background color different from the resting state.
- Use a CSS pseudo-element for the current-page marker; do not add a separate marker element in the HTML.
What you'll practice
- Styling hover and keyboard-focus states.
- Using transitions and pseudo-elements.
- Organizing CSS with consistent class names.
Run it
gonomicon fetch fs-week-1/05-05-interactive-nav-states
cd 05-05-interactive-nav-states
gonomicon test
gonomicon submit
Hints
- Check the link’s resting, pointer-hover, and keyboard-focus styles separately.
- Use the same link class for both interactive states, and give the current link its own modifier class.
- Add a non-empty ::before marker to the current-link modifier and give the base link a positive transition duration.