Technical Documentation Page - Build a Technical Documentation Page

Tell us what’s happening: Hi, May I please get help on Technical Documentation page. I am failing to link the .nav-links to their corresponding main sections on the document. When I press on a particular .nav-link it does not take me its corresponding heading/section even though I have linked each .nav-link to its correspondonding main section. I don’t know where I’m going wrong, please assist. I have not done anything in my CSS so far

Your code so far

<!DOCTYPE HTML>
<html lang="en">
   <head>
      <meta charset="utf-8"/>
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
      <title>Documentation Page</title>
      <link rel="stylesheet" href="./style.css">
   </head>
   <body>
      <main id="main-doc">
         <section class="main-section" id="JS_DOCUMENTATION">
            <header>
               <h1>JS DOCUMENTATION</h1>
            </header>
         </section>
         <section class="main-section" id="Introduction">
            <header>
               <h1>Introduction</h1>
            </header>
            <p>JavaScript is a cross-platform, object-oriented scripting language. It is a small and lightweight language. Inside a host environment (for example, a web browser), JavaScript can be connected to the objects of its environment to provide programmatic control over them.</p>
            <p>JavaScript contains a standard library of objects, such as Array, Date, and Math, and a core set of language elements such as operators, control structures, and statements. Core JavaScript can be extended for a variety of purposes by supplementing it with additional objects; for example:</p>
            <ul>
               <li>Client-side JavaScript extends the core language by supplying objects to control a browser and its Document Object Model (DOM). For example, client-side extensions allow an application to place elements on an HTML form and respond to user events such as mouse clicks, form input, and page navigation.</li>
               <li>Server-side JavaScript extends the core language by supplying objects relevant to running JavaScript on a server. For example, server-side extensions allow an application to communicate with a database, provide continuity of information from one invocation to another of the application, or perform file manipulations on a server.</li>
            </ul>
         </section>
         <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. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.</p>
            <p>In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.</p>
            <p>JavaScript is a very free-form language compared to Java. You do not have to declare all variables, classes, and methods. You do not have to be concerned with whether methods are public, private, or protected, and you do not have to implement interfaces. Variables, parameters, and function return types are not explicitly typed.</p>
         </section>
         <section class="main-section" id="Variable_Scope">
            <header>
               <h1>Variable Scope</h1>
            </header>
            <p>When you declare a variable outside of any function, it is called a global variable, because it is available to any other code in the current document. When you declare a variable within a function, it is called a local variable, because it is available only within that function.</p>
            <p>JavaScript before ECMAScript 2015 does not have block statement scope; rather, a variable declared within a block is local to the function (or global scope) that the block resides within. For example the following code will log 5, because the scope of x is the function (or global context) within which x is declared, not the block, which in this case is an if statement.</p>
            <code>if (true) { var x = 5; } console.log(x); // 5</code>
            <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>
         <section class="main-section" id="Function_Declaration">
            <header>
               <h1>Function Declaration</h1>
            </header>
            <p>A function definition (also called a function declaration, or function statement) consists of the function keyword, followed by:</p>
            <ul>
               <li>The name of the function.</li>
               <li>A list of arguments to the function, enclosed in parentheses and separated by commas.</li>
               <li>The JavaScript statements that define the function, enclosed in curly brackets,<code> { }</code>.</li>
            </ul>
            <p>For example, the following code defines a simple function named square:</p>
            <code>function square(number) { return number * number; }</code>
            <p>The function square takes one argument, called number. The function consists of one statement that says to return the argument of the function (that is, number) multiplied by itself. The return statement specifies the value returned by the function.</p>
            <code>return number * number;</code>
            <p>Primitive parameters (such as a number) are passed to functions by value; the value is passed to the function, but if the function changes the value of the parameter, this change is not reflected globally or in the calling function.</p>
         </section>
         <section class="main-section" id="Referance">
            <header>
               <h1>Referance</h1>
            </header>
            <p>All the documentation in this page is taken from <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide" target="_blank"><span class="web">MDN</span></a></p>
         </section>
         <nav id="navbar">
            <header>
               <h1>JS DOCUMENTATION</h1>
            </header>
            <a class="nav-link" href="/JS DOCUMENTATION/">JS DOCUMENTATION</a>
            <a class="nav-link" href="/Introduction/">Introduction</a>
            <a class="nav-link" href="/JavaScript and Java/">JavaScript and Java</a>
            <a class="nav-link" href="/Variable Scope/">Variable Scope</a>
            <a class="nav-link" href="/Function Declaration/">Function Declaration</a>
            <a class="nav-link" href="/Referance/">Referance</a>
         </nav>
      </main>
   </body>
</html>

Your browser information:

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

Challenge Information:

Technical Documentation Page - Build a Technical Documentation Page

1 Like

It looks like your code was too long to be ported over automatically, so please edit your post and paste your full HTML and CSS code where indicated.

1 Like

Hi @igorgetmeabrain I have just edited

Usually the navbar would be at the top of the page, so I’d be inclined to move the code above all of your .main-section elements.

The main issue, however, is with your href attributes in your .nav-link elements.
If you want your link to go to another element on the same page, the href attribute should point to the id of the element, using a hashtag to denote an id attribute. The href and id attributes should match, and any spaces in their names should be replaced by underscores.

EXAMPLE:

<a href="#Example_Content">Example Content</a>
...
<div id="Example_Content">Example Content</div>

Once you have corrected all of your href attributes, you should pass the corresponding test.

Other things to note:

  1. You should only have one h1 element in your document. For sub-headings you can use h2 (or h3, h4 etc). You may have multiple sub-heading elements of any type.
  2. Properly formatted code will really help with reading and debugging. I have run your code through a formatter and edited your post to show correct indentation and formatting.
  3. It’s only a minor point but you have misspelled ‘Reference’.
  4. When you come to work on your CSS, you’ll need to correct the href below, as the filename is styles.css.
<link rel="stylesheet" href="./style.css">
2 Likes

Thank you so much for your help @igorgetmeabrain I’ll make all the changes above .

1 Like

Also @igorgetmeabrain what formatter did you use?

There are loads out there but I used this one:

2 Likes

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