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

CSS

Why isn't my CSS working for me?

<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Smells Like Bakin' Cupcake Company</title> <link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen"> <link rel="stylesheet" href="css/grid.css" type="text/css" media="screen">

</head> <body> <div class="container"> <div class="grid_4"> <img src="img/logo.gif" alt="Smells Like Bakin"> </div> <div class="grid_8 omega"> <ul class="nav"> <li><a href="#">About</a></li> <li><a href="#">Cupcakes & Prices</a></li> <li><a href="#">Locations</a></li> <li class="last"><a href="#">Contact Us</a></li> </ul> </div> <div id="intro" class="grid_9"> <h1>Opposites really do attract, especially in our kitchen! We combine unexpected flavors that melt together to create ironically delicious desserts.</h1> <p><a href="#" class="btn">Browse Our Cupcakes</a></p> </div> <div class="grid_3" omega> <img src="img/you-bake-me-blush.gif" alt="You Bake Me Blush"> </div> <div id="featured-cupcake" class="grid_7"> <h2>Cupcake of the Week</h2> <p>This week's featured cupcake is the <a href="#"> Avocado Chocolate cupcake</a>. Its strange combo of flavors will kick your tastebuds into fiesta mode!</p> <img src="img/featured-cupcake.jpg" alt="Avocado Chocolate Cupcake"> </div> <div id="new-cupcakes" class="grid_5 omega"> <h2>Fresh Out the oven</h2> <p>Our Newest Cupcakes Are <a href="#"> Bacon Me Crazy</a> and <a href="#"> Jalapeno So Spicy</a></p> <img src="img/new-cupcake-bacon.jpg" alt="Bacon Me Crazy"> <img src="img/new-cupcake-jalapeno.jpg" alt="Jalapeno So Spicy"> </div>

<div class="grid_7">
<h2>Inside the Kitchen</h2>
<p>Smells Like Bakin' started out in the garage of the husband wife duo Allison &amp; Joseph. Allison is the baker, and Joseph found a way for them to make a business out of her tasty treats. Flash forward to today and they have a successful storefront, catering business and cupcake truck.</p>
<p><a href="#" Class="btn-small">Read More</a></p> 

</div>

<div class="grid_5 omega"> <h2>Get Bakin' with Us</h2> </div>

<div id="contact">
  <p>Call us: <span>1-555-CUP-CAKE</span><br>
    <a href="#">bakeon@smellslikebakin.com</a></p>

</div> <p>We announce all of our new flavors first through Facebook & Twitter, and even take requests!</p> <a href="http://www.facebook.com/SmellsLikeBakin"><img src="img/facebook.gif" alt="Facebook"></a> <a href="http://www.twitter.com/#!/SmellsLikeBakin"><img src="img/twitter.gif" alt="Twitter"></a>

<div id="copyright" class="grid_12"> <p>© 2012 Smells Like Bakin' Cupcake Company. All Rights Reserved.</p> </div>

</div> </body> </html>

12 Answers

Marcus Tisäter
Marcus Tisäter
4,886 Points

@Andrew Pritykin You can find them in the Markdown Cheatsheet.

Code

Indent your sentence with 4 spaces (or a single tab) to turn it into a code block.

Andrew Pritykin
Andrew Pritykin
6,574 Points

Katrina, have you included your css file in the header of your html? Also can you post your css? All i see here is html with your css classes.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Smells Like Bakin' Cupcake Company</title> <link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen"> <link rel="stylesheet" href="css/grid.css" type="text/css" media="screen">

<div class="container"> <div class="grid_4"> <img src="img/logo.gif" alt="Smells Like Bakin"> </div>

<div class="grid_8 omega">

<div id="intro" class="grid_9"> <div class="grid_3" omega>

<link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen"> <link rel="stylesheet" href="css/grid.css" type="text/css" media="screen">

It's not letting me post it...

I do have normalize.css and grid.css at the top of my text editor though...

Marcus Tisäter
Marcus Tisäter
4,886 Points

Add this to you're html file

<head> <link rel="stylesheet" type="text/css" href="normalize.css"> <link rel="stylesheet" type="text/css" href="grid.css"> </head>

Marcus Tisäter
Marcus Tisäter
4,886 Points

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

Marcus Tisäter
Marcus Tisäter
4,886 Points

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

Marcus Tisäter
Marcus Tisäter
4,886 Points

Hello Katrina, You have to be more specify why you're CSS isn't working.

Please add you're html and css file so we can help you proceed forward Thanks

I think this is you're problem why the css isn't working.

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

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

I already have those in my file...

Marcus Tisäter
Marcus Tisäter
4,886 Points

Are they located in the same directory?

Meaning?

Marcus Tisäter
Marcus Tisäter
4,886 Points

If the css files are not in the same directory as the html file, it wont work unless you tell HTML href="normalize.css" to look at that map

so for example if you're css files are in a directory called test you have to write:

href="test/normalize.css"

@Marcus--I can't see what you posted...

Marcus Tisäter
Marcus Tisäter
4,886 Points

It's a bug, Check above. Sorry

Andrew Pritykin
Andrew Pritykin
6,574 Points

What are the tags to post code in a comment. (HTML,CSS,Java, ect)

< !DOCTYPE html> < html> < head> < meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> < title>Smells Like Bakin' Cupcake Company</title> < link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen"> < link rel="stylesheet" href="css/grid.css" type="text/css" media="screen">

< /head> < body> < div class="container"> < div class="grid_4"> < img src="img/logo.gif" alt="Smells Like Bakin"> < /div> < div class="grid_8 omega"> < ul class="nav"> < li><a href="#">About</a></li> < li><a href="#">Cupcakes & Prices</a></li> < li><a href="#">Locations</a></li> < li class="last"><a href="#">Contact Us</a></li> < /ul> < /div> < div id="intro" class="grid_9"> < h1>Opposites really do attract, especially in our kitchen! We combine unexpected flavors that melt together to create ironically delicious desserts.</h1> < p><a href="#" class="btn">Browse Our Cupcakes</a></p> < /div> < div class="grid_3" omega> < img src="img/you-bake-me-blush.gif" alt="You Bake Me Blush"> < /div> < div id="featured-cupcake" class="grid_7"> < h2>Cupcake of the Week</h2> < p>This week's featured cupcake is the <a href="#"> Avocado Chocolate cupcake</a>. Its strange combo of flavors will kick your tastebuds into fiesta mode!</p> < img src="img/featured-cupcake.jpg" alt="Avocado Chocolate Cupcake"> < /div> < div id="new-cupcakes" class="grid_5 omega"> < h2>Fresh Out the oven</h2> < p>Our Newest Cupcakes Are <a href="#"> Bacon Me Crazy</a> and <a href="#"> Jalapeno So Spicy</a></p> < img src="img/new-cupcake-bacon.jpg" alt="Bacon Me Crazy"> < img src="img/new-cupcake-jalapeno.jpg" alt="Jalapeno So Spicy"> < /div>

<   div class="grid_7">
<   h2>Inside the Kitchen</h2>
<   p>Smells Like Bakin' started out in the garage of the husband wife duo Allison &amp; Joseph. Allison is the baker, and Joseph found a way for them to make a business out of her tasty treats. Flash forward to today and they have a successful storefront, catering business and cupcake truck.</p>
<   p><a href="#" Class="btn-small">Read More</a></p> 

< /div>

< div class="grid_5 omega"> < h2>Get Bakin' with Us</h2> < /div>

<   div id="contact">
  <   p>Call us: <span>1-555-CUP-CAKE</span><br>
    <   a href="#">bakeon@smellslikebakin.com</a></p>

< /div> < p>We announce all of our new flavors first through Facebook & Twitter, and even take requests!</p> < a href="http://www.facebook.com/SmellsLikeBakin"><img src="img/facebook.gif" alt="Facebook"></a> < a href="http://www.twitter.com/#!/SmellsLikeBakin"><img src="img/twitter.gif" alt="Twitter"></a>

< div id="copyright" class="grid_12"> < p>© 2012 Smells Like Bakin' Cupcake Company. All Rights Reserved.</p> < /div>

< /div> < /body> < /html>

alex mattingley
alex mattingley
7,508 Points

I was having the same issue for a long time. As marcus said, it probably has to do with where the files are located on your computer.

I think you're right!

Normalize and Grid are just layout specific files... normalize.css helps browsers render your content and grid.css is a grid for design layout. Where are your styles? If they are not inline or internal you will need an external style sheet (usually style.css) where you will need to write your css. You link the file in your head same way as with grid and normalize. I do see some classes named in your HTML content but that is different than your selectors, declarations, and attributes; you'll need to have those written and corresponding correctly with your HTML in order for your CSS to work. Hope this helps.

Katrina,

PS: if you are only referring to the grid layout not working and if grid is linked properly recheck your syntax... sometimes easy to miss a simple character...

Thanks :)