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 trialZak Greenawalt
46 Pointshow does css work again?
where do i add the css again?
3 Answers
idan ben yair
10,288 PointsHi Zak,
CSS basically is there to help us style an HTML page in the big scope of things. You should take the rout of the Web Design course here on treehouse to learn more:
http://teamtreehouse.com/tracks/web-design
There is a lot of cool stuff to learn like: animation, font types, responsive and mobile first approach and more.
For example this would be your HTML structure:
<html>
<head><title>this is my test</title></head>
<body>
<h1>This is my header</h1>
<p>
This is my paragraph!
</p>
</body>
</html>
There is 2 ways to go about styling this and give it some colors and other stuff.
- Within the HTML file.
- With an external CSS document.
If you choose to style within it would look like this:
<html>
<head>
<title>this is my test</title>
<style>
p {
color: red;
background-color: blue;
}
</style>
</head>
<body>
<h1>This is my header</h1>
<p>
This is my paragraph!
</p>
</body>
</html>
If you choose to style it from an external CSS file it will look like this:
<html>
<head>
<title>this is my test</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<!-- Create a CSS file and input all your styling in there and link it with this piece of code -->
</head>
<body>
<h1>This is my header</h1>
<p>
This is my paragraph!
</p>
</body>
</html>
Hope I helped you buddy :)
Steve Smith
12,955 PointsIf you're unsure, I'd suggest watching the video again, but the <style> </style>
tags precede the <h1> element in the HTML file.
James Barnett
39,199 Pointshow does css work again?
By "hooking" onto an HTML element.
where do i add the css again?
At this point you'll want to put your CSS rules in the <style>
element.