Learn Basic CSS by Building a Cafe Menu - Step 22

Tell us what’s happening:
how do you create a div type selector?.

Your code so far

<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Cafe Menu</title>
    <link href="styles.css" rel="stylesheet"/>
  </head>
  <body>
    <div>
      <header>
        <h1>CAMPER CAFE</h1>
        <p>Est. 2020</p>
      </header>
      <main>
        <section>
          <h2>Coffee</h2>
        </section>
      </main>
    </div>
  </body>
</html>
/* file: styles.css */
body {
  background-color: burlywood;
}

h1, h2, p, div {
  text-align: center;
  width: 300;

}

Your browser information:

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

Challenge: Learn Basic CSS by Building a Cafe Menu - Step 22

Link to the challenge:

Have a look back at how you selected the body of your page so you could add a background-color to it.

Below is the format used in css to style things in your page. Where it says element/.class/#id is where you specify what you want to style. And everything in the curly brackets will be applied to what you selected.

element/.class/#id {
  property: value;
  property: value;
  ...
}

Hope this helps, if you have any more questions you’d like to ask, I’d be happy to help.

1 Like

per this logic, the div selector will be like as follows:
div { width: 300
}

1 Like

Yep, you got it. Don’t forget to add your units and semi-colon too! :+1:

1 Like