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 trialstephanielong
112 Pointshow to write the style tags
hello, i am just starting out. i can't figure out how to write the style tags correctly here...Thanks
<style>
h1{}
<h1>Nick Pettit</h1>
</body>
2 Answers
Nick Ocampo
15,661 PointsThe style tag goes inside the body tag like so (note that both these tags need to be closed with their corresponding closing tags):
<body>
<style>
</style>
</body>
Your CSS should go inside your style tag
<style>
h1 {
color:blue;
}
</style>
And your html should go outside the style tag, but still inside the body tag.
<body>
<style>
h1 {
color:blue;
}
</style>
<h1>This is part of the HTML inside the body, but not inside the style tag</h1>
</body>
Tyheem Registe
6,810 PointsYou can add styles to your html in three ways in-line which is:
<p style="color: red">text</p>
Internal which is what your trying to do:
<!DOCTYPE html>
<html>
<head>
<title>CSS Example</title>
<style>
p {
color: red;
}
a {
color: green;
}
</style>
</head>
<body>
</body>
</html>
and finally External:
p {
color: red;
}
a {
color: blue;
}
Hope this helps you! : )