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
Reginald Williams
4,818 PointsMy css styling isnt showing. Is there something wrong with my code?
my index.html code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Reginald Williams| User Experience </title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> </head>
my main.css
body { background:green; text-decoration:none; }
wrapper {
max-width:940;
margin: 0 auto;
padding: 0 5%;
background: orange;
}
Reginald Williams
4,818 PointsThank you! i changed it but i still cant get the color or any other format changes to show up
Frank Kepler
16,917 PointsIs this for a challenge or just a personal thing?
Do you have wrapper as a class? In your css it would need to have the period in front of it:
.wrapper
Reginald Williams
4,818 Pointsits for a challenge and I have wrapper as an ID
Frank Kepler
16,917 PointsAs an ID it has to have the Octothorpe in front of it in CSS
#wrapper{
max-width: 940px;
margin: 0 auto;
padding: 0 5%;
background: orange;
}
Reginald Williams
4,818 PointsI used the octothorpe just forgot to copy and paste it but my problem is that none of the formatting is being displayed not only the wrapper id.
8 Answers
John Grillo
30,241 PointsI know someone else already answered in a comment, but in the future, I'd suggest using this free tool to catch inconsistencies like this. I use it all the time!
Check out the w3c for html validator as well. Like what I have to say? Show your appreciation with points or with best answer mark.
Reginald Williams
4,818 Pointsthis was a very helpful tool however my problem is that none of my formatting is showing as if the link to HTML and CSS isnt working
James Head
18,872 PointsHave you used a # in front of your wrapper in the main.css?
Reginald Williams
4,818 Pointsyes and none of the body formatting is being shown either
James Head
18,872 PointsAre you able to show us all of your HTML code?
Reginald Williams
4,818 Points<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Reginald Williams| User Experience </title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> </head> <body> <header> <a href="index.html" id=logo> <h1>Reginald Williams</h1> <h2>User Experience Designer</h2> </a> <nav> <ul> <li><a href="index.html">about</a></li> <li><a href="about.html">other</a></li> <li><a href="page.html">pagr</a></li> </ul> </nav> </header> <div id="wrapper"> <section> <ul> <li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt="picture of something"> <p>ifk</p> </a> </li> <li> <a href="img/numbers-02.jpg"> <img src="img/numbers-02.jpg" alt="picture of something"> <p>playing with photoshop</p> </a> </li> <li> <a href="img/numbers-06.jpg"> <img src="img/numbers-06.jpg" alt="picture of something"> <p>ifk</p> </a> </li> <li> <a href="img/numbers-09jpg"> <img src="img/numbers-09.jpg" alt="picture of something"> <p>ifk</p> </a> </li> <li> <a href="img/numbers-12.jpg"> <img src="img/numbers-12.jpg" alt="picture of something"> <p>ifk</p> </a> </li> </ul> <p>About will go here </p> </section> <footer> <a href="http://twitter.com/reginaldmw"><img src="img/twitter-wrap.png" alt="Twitter Logo"></a> <a href="www.linkedin.com/in/regwill909"><img src="img/linkedin-icon-small.png" alt="Linkedin Logo"></a> <p>Ā© 2014 Reginald Williams.</p> </footer> </div> </body> <html>
Frank Kepler
16,917 PointsThat closing anchor tag under user experience designer may be an issue, where was it opened? I don't see an opening anchor tag for it.
James Head
18,872 Pointsi know this is a simple one but check your main.css is in a css folder and not in the same folder as your HTML
Frank Kepler
16,917 PointsJames Head - That is where I was going next, usually a file/folder file-path issue.
James Head
18,872 Pointshave you used the html, head and body tags they arnt in the HTML code above?
John Grillo
30,241 PointsSo are you using a body selector or an ID or Class? Remember, periods have classes and ID's will pound you.
. = class
= id
Check those. Make sure your file path is correct. max-width:940 should be max-width: 940px;reserved
The background selector should be a hex color, not a reserved word. I know there are some fun ones, but there are just millions more colors than reserved words. And try adding in a space between the wrapper and the { brace, so:
wrapper {
max-width: 940px;
margin: 0 auto;
padding: 0 5%;
background: #EE7600;
}
And again, use my validators for html and css. they will help. http://validator.w3.org/
Reginald Williams
4,818 Points<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Reginald Williams| User Experience </title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css"> </head> <body> <header> <a href="index.html" id=logo> <h1>Reginald Williams</h1> <h2>User Experience Designer</h2> </a> <nav> <ul> <li><a href="index.html">about</a></li> <li><a href="about.html">other</a></li> <li><a href="page.html">pagr</a></li> </ul> </nav> </header> <div id="wrapper"> <section> <ul> <li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt="picture of something"> <p>ifk</p> </a> </li> <li> <a href="img/numbers-02.jpg"> <img src="img/numbers-02.jpg" alt="picture of something"> <p>playing with photoshop</p> </a> </li> <li> <a href="img/numbers-06.jpg"> <img src="img/numbers-06.jpg" alt="picture of something"> <p>ifk</p> </a> </li> <li> <a href="img/numbers-09jpg"> <img src="img/numbers-09.jpg" alt="picture of something"> <p>ifk</p> </a> </li> <li> <a href="img/numbers-12.jpg"> <img src="img/numbers-12.jpg" alt="picture of something"> <p>ifk</p> </a> </li> </ul> <p>About will go here </p> </section> <footer> <a href="http://twitter.com/reginaldmw"><img src="img/twitter-wrap.png" alt="Twitter Logo"></a> <a href="www.linkedin.com/in/regwill909"><img src="img/linkedin-icon-small.png" alt="Linkedin Logo"></a> <p>Ā© 2014 Reginald Williams.</p> </footer> </div> </body> <html>
Reginald Williams
4,818 Pointsi used the header and body tags not sure why they aren't copying when I copy and paste
Frank Kepler
16,917 PointsDouble check where your CSS files are located. The way you have it set up:
main.css and normalize.css should both be contained inside a folder called css.
James Head
18,872 PointsHi Reginald,
Do you use dropbox? If you do, drop your files in there share the link and ill take a closer look and see if I can work out why it isn't working for you.
Reginald Williams
4,818 Pointsboth files are in the css folder !
Frank Kepler
16,917 PointsFrank Kepler
16,917 Pointsmax-width: 940;
I think you meant for that to be:
max-width: 940px;