Learning to Code: Day 34 — Building a Technical Documentation Page

Hello ya’ll. Got me music on in the background and buzzing with this challenge from FreeCodeCamp, it’s a big one. Here’s the example structure to follow. Let’s look at those conditions we have to cover.

#1: I can see a main element with a corresponding id="main-doc", which contains the page's main content (technical documentation).

#2: Within the #main-doc element, I can see several section elements, each with a class of main-section. There should be a minimum of 5.

#3: The first element within each .main-section should be a header element which contains text that describes the topic of that section.

#4: Each section element with the class of main-section should also have an id that corresponds with the text of each header contained within it. Any spaces should be replaced with underscores (e.g. The section that contains the header "JavaScript and Java" should have a corresponding id="JavaScript_and_Java").

#5: The .main-section elements should contain at least 10 p elements total (not each).

#6: The .main-section elements should contain at least 5 code elements total (not each).

#7: The .main-section elements should contain at least 5 li items total (not each).

#8: I can see a nav element with a corresponding id="navbar".

#9: The navbar element should contain one header element which contains text that describes the topic of the technical documentation.

#10: Additionally, the navbar should contain link (a) elements with the class of nav-link. There should be one for every element with the class main-section.

#11: The header element in the navbar must come before any link (a) elements in the navbar.

#12: Each element with the class of nav-link should contain text that corresponds to the header text within each section (e.g. if you have a "Hello world" section/header, your navbar should have an element which contains the text "Hello world").

#13: 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 section element that has that id and contains the corresponding header.

#14: On regular sized devices (laptops, desktops), the element with id="navbar"should be shown on the left side of the screen and should always be visible to the user.

#15: My Technical Documentation page should use at least one media query.

First, as always, I jot out the document type and the meta data and sketch out the borders of the page which covers the conditions 1–13:

<!DOCTYPE html>
<meta charset=”UTF-8">
<meta name=”website” content=”Technical Documentation Page”>
<title>Technical Documentation Page</title>



<body class=“body”>

<nav id=”navbar”>
<header>JS Documentation</header>
<a class=”nav-link” href=”#introduction”>Introduction</a>
<a class=”nav-link” href=”#what_we_know”>What We Know</a>
<a class=”nav-link” href=”#javascript_and_java”>JavaScript and Java</a>
<a class=”nav-link” href=”#hello_world”>Hello World</a>
<a class=”nav-link” href=”#the_variables”>The Variables</a>

<main id=”main-doc”>

<section class=”main-section” id=”introduction”>

<section class=”main-section” id=”what_we_know”>
<header>What We Know</header>


<section class=”main-section” id=”javascript_and_java”>
<header>JavaScript and Java</header>

<section class=”main-section” id=”hello_world”>
<header>Hello World</header>

<section class=”main-section” id=”the_variables”>
<header>The Variables</header>



Of course the layout of this is gonna look shit. But it’s a skinny horse that we now gotta beef out thanks to the data we input into the style tags. We need a media query to occur at least once, and to make the nav appear on the left for viewports such as laptops and desktops. The nav is also supposed to remain always visible to the user, that can easily be done by applying a position:fixed; to the nav element.

For all the p text I just pasted in some Ipsum text, the kinda bollocks you see in IKEA books in store. Fake like everything else there.

Handy little code: I found when I created the nav each option was underlined blue highlighted text for the navigation anchors, so I used a text-decoration: none; to remove that.

Note: It’s worth noting that when the mouse hovers over anchor text we can create the little Micky Mouse glove pointer cursor with a simple cursor:pointer; in the a declaration.

When I was writing the boundaries for the code elements, they where breaking out of their parent elements, so I fixed that with overflow-x: auto;.

..Several hours later..

And we’re finished! I added a background colour to the article elements only to see if they’d looked separated better, and the nav looks skinny on the left, but I’m sure as more sections were added it would fill out the left side. Check out my finished product.

See ya next time!



Frontend Developer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store