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
Joshua Stone
1,176 PointsI am stuck on this challenge question and need help.
Create a type selector that targets the body element. Then, add the text-align property and set the value to center.
8 Answers
MUZ141139 Kenny Mpariwa
13,596 Pointsbody { text-align: center }
Felicia Mabuza
9,408 PointsThis is what I did below and I passed the challenge: body { text-align: center }
Rich Bagley
25,869 PointsHi Joshua,
Without giving you the exact answer, Guil explains what Type selectors are at around 0:04 of this video and shows how to format them at around 3:53.
You can find an example of the text-align property on w3schools.
Hope that helps but just shout if you're still struggling after you've looked over that though :)
-Rich
MUZ140655 Munashe Munongerwa
5,394 PointsKenny u left a ";" tho it will pass but i think using a ";" would be good coding practiz
MUZ1407800 Doubt Milazi
11,813 Pointspliz you should give a try then we will be able to help you basing on the code you write before not jus to give you an exact answer
Tavonga Lewis
2,891 Pointswhat does this mean? Set the background color to orange and the text color to white.
shawn Jones
6,044 PointsThanks my syntax was wrong I had an equal (=) when I was supposed to have a semicolon (:)
The right way body { text-align: center; }
Wrong-way body { text-align= center; }
Alexandru Doru Grosu
2,753 PointsThe selectors that target any of the DOM elements are simply referred to by their name. So, in order to target the body element you would just write
body {
/* your rules go here */
}
The rules, as you know, have the following format:
.example-class-selector {
property: value;
}
And in your challenge, text-align is the property and center is the value.
Gotumile Mothibi
11,973 Pointsdoes it mean it will be .body { text align; center }