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

CSS

I 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

body { text-align: center }

This is what I did below and I passed the challenge: body { text-align: center }

Hi 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

Kenny u left a ";" tho it will pass but i think using a ";" would be good coding practiz

pliz 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

what does this mean? Set the background color to orange and the text color to white.

shawn Jones
shawn Jones
6,044 Points

Thanks 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; }

The 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.

does it mean it will be .body { text align; center }