CSS by Building a Cafe Menu step 22

Step 22
The goal now is to make the div not take up the entire width of the page. The CSS width property is perfect for this. Create a new type selector in the style sheet that gives your div element a width of 300px.

  **Your code so far**
/* file: index.html */
<!DOCTYPE html>
<html>
<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" type="text/css" />
</head>
<body>
  <div>
    <header>
      <h1>CAMPER CAFE</h1>
      <p>Est. 2020</p>
    </header>
    <main>
      <section>
        <h2>Coffee</h2>
      </section>
    </main>
  </div>
</body>
<html>

```css
/* file: styles.css */
body {
background-color: burlywood;
 }
h1, h2, p, div {
text-align: center;
width: 300
}

      **Your browser information:**

User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36 OPR/87.0.4390.58</code>

**Challenge:**  Step 22

**Link to the challenge:**
https://www.freecodecamp.org/learn/2022/responsive-web-design/learn-basic-css-by-building-a-cafe-menu/step-22

You are missing the unit px and the ending semicolon ;

Example

width: 800px;

You are also supposed to create a new div selector, not add it to the list selector.

1 Like

Hey, how do I create a new div to that specifically must be in the html or css file?

2 Likes

Please open your own topic to discuss this.
Only post to someone else’s topic if you are commenting to help them answer their question.