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
Kamali Ganesan
Courses Plus Student 2,269 PointsIn html, css styles arent added
Hi All, I am working with html and css file as a beginner, while I am running the html file the css styles aren't getting applied, I don't know where I went wrong? I have written the exact code as the mentor said even though the styles aren't applied.. Please help me out <!DOCTYPE html> <html> <head> <title> Lake Tahoe</title> <link rel="stylesheet" href="css/stylenew.css"> </head> <body> <header id="top"> <span> Journey throught the Sierra Nevada Mountains </span> <h1> Lake `tahoe, California</h1> </header>
and my Css file p{ color:white; background-color:lightblue; }
body{ background-color: orange; }
header{ background-color: orange; } h1{ font-size: 90px; }
h2{ font-size: 53px; }
}
4 Answers
Joshua Kaufman
19,193 Pointsbalthazear is right about INSERTING type="text/css" into your <link> element in the head tags. In addition, I wrote down a few other notes that might help.
According to what you posted, you did not insert the </body> and </html> tags to the end of your code, in that order. Look at the very end of what I posted to see the two tags inserted into the code at the bottom of the HTML document.
On another note, I would also like to mention that you didn't insert an <h2> element into your code </h2>, so that effect won't show in your HTML. Same goes with the <p> tag that you included in your CSS, but not in your HTML. </p>.
If you include at least the </body> and </html> tags, it
<!DOCTYPE html>
<html>
<head>
<title> Lake Tahoe</title>
<link rel="stylesheet" href="css/stylenew.css"> </head>
<body>
<header id="top"> <span> Journey throught the Sierra Nevada Mountains </span>
<h1> Lake `tahoe, California</h1> </header>
</body>
</html>
Kamali Ganesan
Courses Plus Student 2,269 PointsHi I have closed all tags I just send you the starting line alone didn't show my full codes so I have closed all tags and also as you both said I have used type tag also then also my CSS styles aren't getting along.
Joshua Kaufman
19,193 PointsI just noticed that you have an extra closing curly brace in your CSS. Remove that extra one at the VERY bottom, and see how it works. You should just have 5 pairs of open and close braces (at least until you keep moving) where you have those PLUS an additional closing brace }. That will definitely cause unwanted behavior.
Kamali Ganesan
Courses Plus Student 2,269 Pointsthank you all it helped me to identify the mistake I made and worked out
balthazear
5,824 Pointsbalthazear
5,824 PointsMaybe because type is missing? Also make sure that the stylenew.css is in the css folder.
<link rel="stylesheet" type="text/css" href="css/stylenew.css">