Help with DIV and background-color

I am having some issue with getting a color to show up in my div element. I have changed it from id to class, added height, weight, margin, and padding, yet sill cannot get the color to show up behind my div. Any idea what I am doing wrong?

Code is below:

<title></title>
<body>
<div class="About Me">
<h1>
 About Me
</h1>
</div>
<div id=Services>
<h1>
Services
</h1>
</div>
<div id="Recent Work">
<h1>
Recent Work
</h1>
</div>
<div id="Contact">
<h1>
Contact
</h1>
</div>
</body> ```

.about-me {
  background: green
  margin: 0;
  padding: 0;
  height: 100px;
  width: 100px;
}
.about-me { background:gold; margin: 0; padding: 0; height: 100px; width: 100px; }
This is how its done;

You might need to repost your code again, I’m only seeing your style for .about-me

Typically if I’m looking to add a background color to a div I’ll do something like this: https://codepen.io/drding/pen/YQazaO

I’ve used your styling there as an example and made the background black and the text white.

Remember, when you post code blocks, surround them with three backticks (the key below the ESC).

On one like put your three backticks…
then your code (on a new line) …
then another three backticks (on a new line).

It will keep the html from getting interpreted and will keep indenting so everything looks nice.

1 Like

Ok. I have made my code visible now. Even typing “background: color;” doesn’t do anything. I am thinking that there is something wrong with the HTML.

Figured it out, it wasn’t properly selected

1 Like