CSS

Taysia Brayshaw
Taysia Brayshaw
Front End Web Development Techdegree Student 836 Points

My CSS is not changing on my webpage even though I save my workspace.

I am on the Intro to HTML & CSS lesson "Select and Style by Element" I added in the <h3>A New Subsection</h3> and that showed up in my webpage. Now I am trying to format the color and line-spacing within the CSS sheet and when I make changes nothing happens to my h3. However, I can change prewritten code, like the a tag color for example, and it changes within my webpage. So I know my CSS sheet is linked to my HTML.

This is the code I have in HTML:

<h3>A New Subsection</h3>

This is the code I have in CSS: (which is the code not showing up/changing)

h3 { color: blue; letter-spacing: 2px; }

What am I doing wrong?

Taysia Brayshaw
Taysia Brayshaw
Front End Web Development Techdegree Student 836 Points

Except there is the proper spacing between the CSS coding, this just took that formatting away

2 Answers

Dane Parchment
MOD
Dane Parchment
Treehouse Moderator 9,663 Points

Without access to your workspace, we can't really give a definitive answer to your problem. However, there are a few things we can try to troubleshoot that may fix the issue.

  1. If you are housing your styles in an external css file, make sure you link the css file in the <head> element of your html. Like so: <link rel="stylesheet" href="./relative/path/to/css/file">.
  2. If you aren't using an external css file, make sure you add the styles to the <style> tag which is also found in the <head> tag. Like so:
<head>
<style>
h1 {
color: blue;
}
</style>
</head>
  1. If you are using inline-styles make sure you are using them properly and placing them in the styles="css:code;" attribute.

Finally, make sure you are targetting the correct elements and aren't overriding the CSS anywhere.

P.S. Maybe it is also the fact that you aren't linking to the proper stylesheet, you can test this by opening up the source code of the webpage, and clicking on the link to your CSS file. If it doesn't show the code and instead gives you an error, then you aren't properly linking to the file.

Taysia Brayshaw
Taysia Brayshaw
Front End Web Development Techdegree Student 836 Points

Thanks for your help! Here is the link to my workspace, I don't know how else to share it (This is day two of Treehouse Techdegree for me). https://teamtreehouse.com/workspaces/40950465

Hopefully that lets you see what I'm working on but for now I'm going to try some of the options you suggested!

Taysia Brayshaw
Taysia Brayshaw
Front End Web Development Techdegree Student 836 Points

Sorry Dane, I just recently learned how to link the workspace correctly, but I actually figured it out with your help and another member on slack, the issue wasn't my code but my browser cache needed clearing so the code would show up correctly! Thank you for taking the time to help me out!