Back to Freecodecamp

Step 7

curriculum/challenges/english/blocks/workshop-blog-page/669fde2081f65141ad703fe4.md

latest2.2 KB
Original Source

--description--

The first section on the page will be the about section. The section will introduce Mr. Whiskers and give users an idea of what this blog is about.

Inside your main element, add a section element with the id attribute set to "about".

Inside the section element, add an h2 with the text of About.

--hints--

Your section element should have an opening tag.

js
assert.match(code, /<section.*>/);

Your section element should have a closing tag.

js
assert.match(code, /<\/section\>/);

Your section element should have an id set to "about".

js
const sectionElement = document.querySelector('section');
assert.strictEqual(sectionElement?.getAttribute("id"), "about");

Your section element should be within your main element.

js
const sectionElement = document.getElementById('about');
assert.strictEqual(sectionElement?.parentElement.tagName, 'MAIN');

Your h2 element should have an opening tag.

js
assert.match(code, /<h2\>/);

Your h2 element should have a closing tag.

js
assert.match(code, /<\/h2\>/);

Your h2 element should have the text of About. Double check your spelling.

js
const h2Element = document.querySelector('body h2');
assert.strictEqual(h2Element?.innerText.trim(), "About");

Your h2 element should be within your section element.

js
const h2Element = document.querySelector('#about h2');
assert.strictEqual(h2Element?.parentElement.tagName, 'SECTION');

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Mr. Whiskers' Blog</title>
    <meta charset="UTF-8" />
  </head>
  <body>
    <header>
      <h1>Welcome to Mr. Whiskers' Blog Page!</h1>
      <figure>
        
        <figcaption>Mr. Whiskers in the Garden</figcaption>
      </figure>
      <nav>
        <ul>
          <li><a href="#about">About</a></li>
          <li><a href="#posts">Posts</a></li>
          <li><a href="#contact">Contact</a></li>
        </ul>
      </nav>
    </header>
    <main>
--fcc-editable-region--
      
--fcc-editable-region--
    </main>
  </body>
</html>