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 trialArcel Derosena
Front End Web Development Techdegree Student 5,241 Pointswhere do I write CSS to select h1 ?
The challenge is to write CSS to select h1, yet I'm not sure how. What should I write and where ?
<h1>
<style>
<body>
<h1>Nick Pettit</h1>
</body>
3 Answers
Dean Osborne
3,775 PointsHi Arcel,
From your code it looks as if you are required to use internal styling for this challenge, see below for the solution to the challenge.
<head>
<style>
h1 {
PROPERTY: VALUE;
}
</style>
</head>
<body>
<h1>Nick Pettit</h1>
</body>
Within the <style> tags i have written h1 before the curley braces, this is known as the selector.
I hope this helps you.
Nick Hooper
7,188 PointsStyles can be defined in 3 ways:
Inline - using a style attribute in HTML elements.
Internal - using a <style> element in the HTML <head> section.
External - using css files.
The best way is the external method by adding the style to the corresponding css file.
//Inline Example, put this in the element itself
<h1 style="Your css styles goes here">Nick Pettit</h1>
//Internal Example, put this in your html file
<style>
h1 {
//Your css styles goes here
}
</style>
//External Example, put this in your css file
h1 {
//Your css styles goes here
}
//Don't forget when using external css files you must make a link to it in your html file!
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
Arcel Derosena
Front End Web Development Techdegree Student 5,241 PointsThanks I might experiment with that one.
qasimalbaqali
17,839 PointsIf it's asking you to write it in the css file then write
h1 {
// Your css styles goes here
}
Arcel Derosena
Front End Web Development Techdegree Student 5,241 PointsArcel Derosena
Front End Web Development Techdegree Student 5,241 PointsThanks, I thinked it work.