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 trialDesmond Dallas
6,985 PointsCss/HTML
Can anyone help me with this. It is driving me crazy lol.
Ive done code for HTML and CSS. When I incode CSS on the same page as HTML its fine when refreshing browser. Now when I put the CSS in a different file and link it to the HTML file it all goes wrong. Can you look on these and tell me what is wrong please.
CSS FILE <style> ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #FF8C00; }
li { float: right; }
li a { display: block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; }
li a:hover { background-color: #111; } </style>
HTML FILE <!DOCTYPE html> <html> <head>
<link rel="stylesheet" href="styles.css">
<body>
<ul> <li><a class=βactiveβ href=β#homeβ>Home</a></li> <li><a href=β#newsβ>News</a></li> <li><a href=β#contactβ>Contact</a></li> <li><a href=β#aboutβ>About</a></li> </ul>
</body> </html>
5 Answers
Christopher De Lette
Courses Plus Student 7,139 PointsFirst thing you don't have a closing </head> tag after your link reference and not sure what you named your css file however make sure it exactly matches what you have listed in the href attribute of your link tag in the head section.
Hope this helps,
Chris
Magnus Martin
44,123 PointsHi,
did you leave the <style>-Tags in the separate css-file? You should have them removed when using a separate file.
Desmond Dallas
6,985 PointsThanks something changed but still not working. Ive placed the HTML and CSS Files in a folder, which I named 'My Website'.
The CSS file is named 'styles.css and HTML file name 'index.html'.
The ref link in HTML file: <link rel="stylesheet" href="styles.css">
Desmond Dallas
6,985 PointsHaaaa its working now... Thanks guys nice one
Magnus Martin
44,123 PointsHow did you solve the prob?
Desmond Dallas
6,985 PointsIf I remember correct I didn't but the HTML and CSS files in the same folder