Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML Introduction to HTML and CSS (2016) Adding a New Web Page Write the CSS

Nadia Masiero
Nadia Masiero
3,468 Points

CSS not working properly. h1 tag messed up?

Okay so I'm in the "Write the CSS" video trying to add my own code, but I don't think it's working properly when I try to add the padding and background-color for my h1 tag. The first box is my CSS and the second is my HTML

body  {
  font-family:"Ariel";
}
.main-img  {
  border: solid 4px black;
  border-radius: 50%;
 }
h1  {
  background-color: #e2e2e2;
  padding: 5px;
}
<!DOCTYPE html>
<html>
<head>
  <title>Photography</title>
  <link rel="stylesheet" href"photos.css">
    </head>

<body>
  <img src="images/me.png" alt="Converse" class="main-img">
    <h1>Nadia Masiero's Photography</h1>
  </body>
</html>

4 Answers

Matthew Lawson
Matthew Lawson
7,283 Points

How about just...

h1  {
  color: #e2e2e2;
  padding: 5px;
}

Not sure if the H1 itself needs a background color, so by just using the property of "Color:" you're directly changing the color of the text.

Hope this helps! :)

Nadia Masiero
Nadia Masiero
3,468 Points

I was trying to follow what she was doing in the video, but none of it was appearing/changing when I refreshed the page. I will try this and see how it works! Thanks for the help man!

Your stylesheet link href seems to be the fault here.

<link rel="stylesheet" href="photos.css">
Nadia Masiero
Nadia Masiero
3,468 Points

I'll have to play around with it more. Thanks for the help!

N E
N E
534 Points

I had the same issue. When making a change to your code you have to always save the code first by CTRL + S, or just manually saving, otherwise it won't properly show up on your resume page.

Matthew Lawson
Matthew Lawson
7,283 Points

No worries Nadia Masiero - let us know how you get on :)