Hello everyone. How should i go about this? I'm stuck. Please Help

Tell us what’s happening:
Describe your issue in detail here.

  **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>
.menu{}  <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 6.1; rv:101.0) Gecko/20100101 Firefox/101.0

Challenge: Step 28

Link to the challenge:

What you have added here is a CSS ruleset. This is what you would do in the CSS file. But when you want to add a class to an HTML element then you need to use the class attribute on the element. Adding a class attribute is just like adding an href attribute for the link element above. Follow that example to add the class attribute and its value.

Hi @bbsmooth, i don’t understand. Should it be within the div tag?

Look at the link element you already created:

<link href="styles.css" rel="stylesheet" type="text/css" />

The href is the attribute name and "styles.css" is the value of the attribute. You would do the same thing to add a class attribute with the value menu to the div.

1 Like

Than you @bbsmooth I now understand. Cheers!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.