Learn Basic CSS by Building a Cafe Menu - Step 28

Trying to apply class’s style to div element

  **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 {
text-align: center;
}

.menu {
width: 80%;
background-color: burlywood;
margin-left: auto;
margin-right: auto;
}
  **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 28

Link to the challenge:

you haven’t said why you need help so I’m going to assume you are not familiar with attributes…

Attributes are key=“value” pairs (usually) that you add to html element opening tags.
For eg. href is an attribute and it is added to the anchor tag.
src is an attribute and it is added to the img tag.

So now, given this information about attributes, how should you add the class attribute to the div tag?

1 Like

we are asked to put a class element in the Div and this class attribute’s should have “value” as its value. Please what is the correct syntax?

is this correct?

Mod edit: solution removed

try this, this is the answer

Please don’t share solutions to fCC challenges on the forum.
You are more than welcome to contribute by giving hints and tips though.

okay, sorry my mistake

Thank you so much! I read this and I understand what the exercise ask.

Now I know what is attribute!

1 Like

backround -???: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg)
look and read close