You're missing the unit. I guess you're using pixels, so it'd be something like this:
@media (max-width:600px) {
body{
background-color:red;
}
}
p{
color:blue;
}
Demo: http://jsbin.com/fovesaci/1/
Edit: About the second question, you need to place it in parentheses. So this media='max-width: 600px'
should be something like this media='(max-width: 600px)'
.
It's a reasonable mistake since media attr has been mostly used for print
, screen
or all
which have no parentheses at all.