Always one of the boxes should be green and one red.
.elem {
width:200px;
height:200px;
background-color:#911;
margin:20px;
}
/* If at least 300px wide and the device is able to hover */
@media (min-width: 300px) and (hover: hover) {
#carl {
background-color:#191;
}
}
/* If maximum 300px wide OR the the device is not able to hover */
@media (max-width: 300px), (hover: none) {
#dude {
background-color:#191;
}
}
/* Try the exact opposite of the first media query also fails */
@media not all and (min-width: 300px, "bigheader")) and (hover: hover) {
#dude {
background-color:#191;
}
}
<div id="carl" class="elem"></div>
<div id="dude" class="elem"></div>
Basically the second media query is doing the exact opposite of the first media query. Unfortunatly this is only working for browsers which are supporting CSS4 media interaction features media queries.
For Browsers like IE 11 which do not support it, both boxes are red and the second media query fails. However I want browsers to fallback on the second possibility in case the first is not supported. Can you help me out?