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 Unused CSS Stages Media Queries Media Features and Media Types

Marta Dias
Marta Dias
9,240 Points

Code not working

I doing exactly the same, Writing the exact same code. And mine isn't working. It simple won't change.
Anyone?

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Marta,

Could you post the exact question please, along with any code you have wrote. That way it's easier for us to help you.

Here is a link to explain how to use Markdown to post your code How to post code

If you look at the bottom of the box when your typing a reply you will see Markdown Cheatsheet that will also explain how to post your code.

Marta Dias
Marta Dias
9,240 Points
body {
    font: 1.1em/1.5 helvetica;
}

.wrap {
    width: 85%;
    margin: auto;
}

h1 {
    font-size: 3em;
}

p {
    margin-bottom: 1.5em;
}

/* -------------------
MEDIA QUERIES
-----------------------------*/

@media screen and (max-width: 768px) {
    body {
        background: #ff6347;
        color: #fff;
    }

}

@media screen and (max-width: 480px) {
    body {
        background: #4682b4;
    }

}
Wayne Priestley
Wayne Priestley
19,579 Points

Marta,

I still need to know what the question or challenge is.

I've edited your code so it appears correct in your post.

7 Answers

Kristi Smythe
Kristi Smythe
10,665 Points

Hi Marta,

That error message is an indication the link to your css file is not correct in the head tag of your html file. The other possibility if your css file path (location on your server) does look like the code snippet below, is that you might need to ftp your css file to your server in a css folder (directory) or as you've specified in the link path.

I hope this helps. Cheers, Kristi

The link in your html file should look something like this:

    <!DOCTYPE html>
        <head>
            <title>Your Site Title</title>

            <link rel="stylesheet" href="css/main.css"> 
        </head>
    </html>
    ```
Marta Dias
Marta Dias
9,240 Points

I just missed that! you're totally right!

thank you

Casey Antoine
PLUS
Casey Antoine
Courses Plus Student 5,174 Points

Marta,

I assume you're having issues with the site not being responsive depending on the size of the display. Id try to use min-width instead of max-width and style so that you see what you want and edit want changes as the display gets smaller instead.

@media screen and (min-width: 480px)
Marta Dias
Marta Dias
9,240 Points

Still doesn't work.

and it's exactly what he have in the video!

Marta Dias
Marta Dias
9,240 Points

Basically there's no challenge .. I'm doing at the time time. But mind doesn't work. It's the first video from the CSS foundations Media Queries.

Casey Antoine
PLUS
Casey Antoine
Courses Plus Student 5,174 Points

If the css is still not working, possibly check the link to the css within the HTML doc just to make sure that its pulling all of your css files and putting them to use.

I had an issue once where my workspace would not save all my data correctly, so when viewing the preview I was actually viewing an older save of the current workspace.

Try going to File drop down menu and Save All and see if that fixes the problem. (Ctrl+Alt+S)

Also try reloading workspaces.

(All under the assumption that you are using workspaces..)

And defiantly try Casey Antoine's suggestion with the HTML CSS link.

Marta Dias
Marta Dias
9,240 Points

I'm working on my own workplace! With sublime 2.

So apparently it's something on my server.

i open the inspect to check the code and 1 have one error! Failed to load resource: The requested URL was not found on this server.

Joga Gavidia
Joga Gavidia
4,047 Points

Hello Marta, Can you provide the url?