I need to show two different logos on my site depending on the device width. If the screen size of device is 300px or less than it, i need to show small logo.
Site: http://www.geekdashboard.com/
Logo.png -> http://www.geekdashboard.com/wp-content/themes/geekdashboard/images/logo.png
logo-small.png -> http://www.geekdashboard.com/wp-content/themes/geekdashboard/images/logo-small.png
CSS:
.header-image .site-title > a {
background: url(images/logo.png) no-repeat left;
float: left;
min-height: 90px;
width: 425px;
}
and CSS for small width devices as follows
@media only screen and (max-width: 320px) {
.header-image .site-title > a {
background: url(images/logo-small.png) no-repeat left!important;
width: 300px!important;
}
}
This code is not working as expected for me. I can still see the logo.png even on devices with screen size less than 300px Thanks in advance
Specifying the media type should work fine.
@media only screen and (max-width: 320px) {
.header-image .site-title > a {
background: url(images/logo-small.png) no-repeat left !important;
width: 300px !important;
}
}
@media only screen and (min-width: 321px) {
.header-image .site-title > a {
background: url(images/logo.png) no-repeat left;
float: left;
min-height: 90px;
width: 425px;
}
}