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
Carl-Kaspar Puhm
Front End Web Development Techdegree Student 8,692 PointsWhat is wrong with my css?
in html i have a div for the navigation:
<div class="main-nav"> <h1>Some content here</h1> </div>
in my style.css file, which is linked properly cause everything else works i have:
.main-nav { width: 100%; background-color: #262626; min-height: 30px; padding: 10px; position: fixed; text-align: center; }
but the styles dont apply to the page. i'm using the workspaces
whats the error?
Dennis Amiel Domingo
17,813 PointsI think we need more information because I tried your html and css and they worked fine in Workspaces. I even tried it in Notepadd ++ and it worked fine too. There might be declarations in your CSS that are overriding your .main-nav styles if you're sure that it's not a linking issue. Can you post the whole block of code so we can troubleshoot?
2 Answers
Rafael silva
23,877 PointsFriend I had several problems like these that you have in css but then what you should do at that time, first check-out if your extension is rigth like when you save you css. remember to put inside of your HTML like this: I hope help you , (Rafael macedo) good luck! example:
<html !DOCTYPE> <head> <!-- here will follow this link of css proprety--> <link rel="stylesheet" href="styles.css" > <!-- here follow the link , make like this and you will solve your problem--> <title>example</title> </head> <body>
</body>
<html>
Amanda Westrup
6,506 PointsDo you have it in a media query? If the browser window is set to a specific media break it will take whatever that .main-nav is. Check in the dev tool in Chrome. If it isn't registerering at all, then it's a bit odd as everything is reading correctly.
Hadi Khalili
7,969 PointsHadi Khalili
7,969 PointsRemove the position deceleration and then try.
Also for your workspace, and post it error might be in a different place.