I'm working on a responsive site where each page will have a large hero image, defined in the CMS. I'd like to avoid having to download that background image on mobiles.
The only way I can think to do it is to have some inline CSS in the head of the page like so:
<style type="text/css">
@media only screen and (min-width: 680px) {
.hero-image { background-image: url(../images/image.jpg); }
}
</style>
First, can I use media queries in inline CSS?
Second, will this avoid downloading the image on mobiles?
Third, is there a better way?
Thanks