I’m working on the Responsive Web Design Project #4 - Build a Technical Documentation Page. Below are the following use cases that fail, according to CodePen:
- Each element with the class of “main-section” should also have an id that corresponds with the text of each contained within it. Any spaces should be replaced with underscores (e.g. The that contains the header “Javascript and Java” should have a corresponding id=“Javascript_and_Java”). (Content, #4)
- Additionally, the navbar should contain link () elements with the class of “nav-link”. There should be one for every element with the class “main-section”. (Content, #10)
- Each element with the class of “nav-link” should contain text that corresponds to the text within each (e.g. if you have a “Hello world” section/header, your navbar should have an element which contains the text “Hello world”). (Content, #12)
- When I click on a navbar element, the page should navigate to the corresponding section of the “main-doc” element (e.g. If I click on a “nav-link” element that contains the text “Hello world”, the page navigates to a element that has that id and contains the corresponding . (Content, #13)
- On regular sized devices (laptops, desktops), the element with id=“navbar” should be shown on the left half of the screen. It should always be visible to the user and should remain stationary. You may need to enlarge the viewport or zoom out to ensure the navbar doesn’t scroll with the page content. (Layout, #1)
I don’t know why CodePen says I’m failing on these. My code appears to pass these use cases. My code snippets are below, and the preview for my CodePen project appears to work as expected (please fork my project to get my full code files and the CodePen preview):
- Content, #4
<section class="main-section" id="Objects">
<header>
<h1>Objects</h1>
<section class="main-section" id="Classes">
<header>
<h1>Classes</h1>
<section class="main-section" id="Variables">
<header>
<h1>Variables</h1>
<section class="main-section" id="Constants">
<header>
<h1>Constants</h1>
<section class="main-section" id="Primitive_Types">
<header>
<h1>Primitive Types</h1>
- Content, #10; Content, #12; and Content, #13
<nav id="navbar">
<header>
Major Java Elements
</header>
<ul>
<li class="nav-link"><a href="#Objects">Objects</a></li>
<li class="nav-link"><a href="#Classes">Classes</a></li>
<li class="nav-link"><a href="#Variables">Variables</a></li>
<li class="nav-link"><a href="#Constants">Constants</a></li>
<li class="nav-link"><a href="#Primitive_Types">Primitive Types</a></li>
</ul>
</nav>
- Layout, #1
@media (min-width: 992px) {
#navbar {
position: fixed;
top: 0;
background-color: white;
width: 100%;
}
#main-doc {
padding-top: 130px;
}
}
Thanks so much!