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 trialhaakon Guttormsen
2,157 Pointsstyling issues
Hi, I am doing the follow along on "how to make websites". In one of the first styling steps I am supposed to style a div-tag named wrapper. In CSS I write the following css-rule:
wrapper{
max-width: 940 px;
margin: 0 auto;
background : orange ;
}
When Nick refreshes hes browser he get a space between the orange colored div-area and the sides of the browser. When i do the same code the orange area is going all the way to the sides of the page.
I add a link to the snapshot here: https://w.trhou.se/wpz6283jbf
Why do I not see the div-area the same way as Nick does?
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey there,
There could be a couple of possible reasons:
First, in the CSS above that you provided, you have just
wrapper
. You mention that you are to style a <div> "named" ... but tags don't have "names" in that sense. The worddiv
is the name of the tag, then tags can have anID
or aclass
. If I remember correctly, this lesson asks for styling on the <div> with the classwrapper
. Now remember, classes are selected in CSS by prefixing theclass name
with a#
symbol (which is missing in your CSS above).When I look at your Workspace snapshot, there is nothing in the CSS folder. So, maybe you didn't save the file before trying to preview?
Check out those two things and see if that fixes the problem.
Hope that helps.
Jason Anders
Treehouse Moderator 145,860 PointsHi,
I got your corrected link.
In your #wrapper
rule, you have max-width
set to "940 px" with a space. While white space doesn't usually affect CSS, there are some exceptions. This is one of them. Just remove the space (so you have 940px) and save and refresh and it works.
:)
haakon Guttormsen
2,157 Pointshaakon Guttormsen
2,157 PointsThanks for replying.
I sent you the wrong link. Here is the correct one: https://w.trhou.se/x8ltm1x4k8
As you can see I use the "hash" in front of wrapper in my css. I have also saved it so it has to be something else.