Responsive Web Design Projects - Build a Technical Documentation Page

Tell us what’s happening:
Each .main-section should have an id that matches the text of its first child, having any spaces in the child’s text replaced with underscores (_ ) for the id’s.
Each .main-section should have an id that matches the text of its first child, having any spaces in the child’s text replaced with underscores (_ ) for the id’s.
You should have the same number of .nav-link and .main-section elements.
Each .nav-link should have an href attribute that links to its corresponding .main-section (e.g. If you click on a .nav-link element that contains the text “Hello world”, the page navigates to a section element with that id).

Your code so far

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="styles.css"/>
  <main id="main-doc">
<nav id="navbar">
   <header><h1>JS Documentation</h1></header>
<li><a class="nav-link" href="#Introduction" </a>Introduction</li>
        <li><a class="nav-link" href="#What_you_should_already_know">What you should already know</a>
        <li><a class="nav-link" href="#JavaScript_and_Java">JavaScript and Java</a>
        <li><a class="nav-link" href="#Hello_world">Hello world</a>
        <li><a class="nav-link" href="#Variables">Variables</a>
        <li><a class="nav-link" href="#Declaring_variables">Declaring variables</a>
        <li><a class="nav-link" href="#Variable_scope">Variable scope</a>
        <li><a class="nav-link" href="#Global_variables">Global variables</a>
        <li><a class="nav-link" href="#Constants">Constants</a>
        <li><a class="nav-link" href="#Data_types">Data types</a>
        <li><a class="nav-link" href="#if...else_statement">if...else statement</a>
        <li><a class="nav-link" href="#while_statement">while statement</a>
        <li><a class="nav-link" href="#Function_declarations">Function declarations</a>
        <li><a class="nav-link" href="#Reference">Reference</a>
      <section class="main-section" id="Introduction">
<p>JavaScript is a cross-platform, object-oriented scripting language. 
Core JavaScript can be extended for a variety of purposes by supplementing it with additional objects; for example:
JavaScript is a very free-form language compared to Java.</p>
    <section class="main-section" id="What_you_should_already_know">
      <header><h1>What you should already know</h1></header>
   <p>This guide assumes you have the following basic background:</p>
<li>A general understanding of the Internet and the World Wide Web (WWW).</li>
<li>Good working knowledge of HyperText Markup Language (HTML).</li>
<li>Some programming experience. If you are new to programming, try one of the tutorials linked on the main page about JavaScript.</li></ul>
        <section class="main-section" id="JavaScript_and_Java">
      <header><h1>JavaScript and Java</h1></header>
     <p> JavaScript and Java are similar in some ways but fundamentally different in some others.</p>
        <section class="main-section" id="Hello_World">
      <header><h1>Hello World</h1></header>
      <p>To get started with writing JavaScript, open the Scratchpad and write your first "Hello world" JavaScript code:</p>
      <code>function greetMe(yourName) { alert("Hello " + yourName); }
         <section class="main-section" id="Variables">
      <p>You use variables as symbolic names for values in your application. The names of variables, called identifiers, conform to certain rules.</p>
        <section class="main-section" id="Declaring Variables">
      <header><h1>Declaring Variables</h1></header>
      <p>You can declare a variable in three ways:
With the keyword var. For example,</p>
<code>var x = 42.</code>
        <section class="main-section" id="Variable_scope">
      <header><h1>Variable scope</h1></header>
      <p>This behavior changes, when using the let declaration introduced in ECMAScript 2015.</p>
      <code>if (true) { let y = 5; } console.log(y); // ReferenceError: y is
not defined</code>
         <section class="main-section" id="Global_variables">
      <header><h1>Global variables</h1></header>
      <p>Global variables are in fact properties of the global object. In web pages the global object is window, so you can set and access global variables using the window.variable syntax.</p>
        <section class="main-section" id="Constants">
      <p>A constant cannot change value through assignment or be re-declared while the script is running. It has to be initialized to a value.</p>
     <code>// THIS WILL CAUSE AN ERROR function f() {}; const f = 5; // THIS
WILL CAUSE AN ERROR ALSO function f() { const g = 5; var g;
//statements }</code> 
        <section class="main-section" id="Data_types">
      <header><h1>Data types</h1></header>
  <p>The latest ECMAScript standard defines seven data types:</p>
    <li>Six data types that are primitives:</li>
  <li>Boolean. true and false.</li>
    <li>Number. 42 or 3.14159.</li>
      <li>String. "Howdy"</li>
    <li>and Object</li>
        <section class="main-section" id="if...else statement">
      <header><h1>if...else statement</h1></header>
      <p>You may also compound the statements using else if to have multiple conditions tested in sequence, as follows:</p>
      <code>if (condition_1) { statement_1; } else if (condition_2) {
statement_2; } else if (condition_n) { statement_n; } else {
statement_last; }</code>
        <section class="main-section" id="while_statement">
      <header><h1>while statement</h1></header>
      <p>A while statement executes its statements as long as a specified condition evaluates to true. A while statement looks as follows:</p>
      <code>while (condition) statement</code>
        <section class="main-section" id="Function_declarations>
      <header><h1>Function declarations</h1></header>
      <p>A function definition (also called a function declaration, or function statement) consists of the function keyword, followed by:</p>
  <li>The name of the function.</li>
  <li>The JavaScript statements that define the function, enclosed in curly brackets, { }.</li>
    <code>function square(number) { return number * number; }</code>
        <section class="main-section" id="Reference">
      <li>All the documentation in this page is taken from <a href="" src="Javascript" alt="Javascript">MDN</a> </li>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Responsive Web Design Projects - Build a Technical Documentation Page

Link to the challenge:

Hi there, I modified your post to make the code block more readable.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.