Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

What is wrong with this media query

What is wrong with this media query

Problem

I would be much obliged to anyone who might be able to tell me why this Media Query only works partially (the font size changes but not the color).

This is one and this is two and now back in one
@media all and (min-width:500px) { #two{font-size:2em;color:#0000ff;text-decoration:underline;} } #two{color:red;}

Here is a fiddle showing the problem in action. Just drag the resize bar to adjust the size of the output window. The font size changes as expected but the color stays put.

Problem courtesy of: DroidOS

Solution

Because #two{color:red;} overrides the style in the media query because you put it after the media query. Put it before - JSFiddle

Solution courtesy of: Vucko

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

What is wrong with this media query

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×