Back to Freecodecamp

Step 13

curriculum/challenges/english/blocks/learn-accessibility-by-building-a-quiz/614090d5a22b6f0a5a6b464c.md

latest2.1 KB
Original Source
<!-- TODO: I purposefully added the `nav` styles without Camper input -->

--description--

The child combinator selector > is used between selectors to target only elements that match the second selector and are a direct child of the first selector.

This can be helpful when you have deeply nested elements and want to control the scope of your styling.

Use the > selector to target the unordered list elements within the nav elements, and use Flexbox to evenly space the children.

--hints--

You should use the nav > ul selector.

js
assert.exists(new __helpers.CSSHelp(document).getStyle('nav > ul'));

You should give the nav > ul elements a display of flex.

js
assert.equal(new __helpers.CSSHelp(document).getStyle('nav > ul')?.display, 'flex');

You should give the nav > ul elements a justify-content of space-evenly.

js
assert.equal(new __helpers.CSSHelp(document).getStyle('nav > ul')?.justifyContent, 'space-evenly');

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="freeCodeCamp Accessibility Quiz practice project" />
    <title>Accessibility Quiz</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <header>
      
      <h1>HTML/CSS Quiz</h1>
      <nav>
        <ul>
          <li><a>INFO</a></li>
          <li><a>HTML</a></li>
          <li><a>CSS</a></li>
        </ul>
      </nav>
    </header>
    <main></main>
  </body>
</html>

css
body {
  background: #f5f6f7;
  color: #1b1b32;
  font-family: Helvetica;
  margin: 0;
}

header {
  width: 100%;
  height: 50px;
  background-color: #1b1b32;
  display: flex;
}

#logo {
  width: max(10rem, 18vw);
  background-color: #0a0a23;
  aspect-ratio: 35 / 4;
  padding: 0.4rem;
}

h1 {
  color: #f1be32;
  font-size: min(5vw, 1.2em);
}

nav {
  width: 50%;
  max-width: 300px;
  height: 50px;
}

--fcc-editable-region--

--fcc-editable-region--