Change image using only CSS
I'm using the twenty fifteen theme.
I have a logo set using the WP Customizer.
I want to have the image change on mobile or tablet view.
The breakpoint is anything smaller than 59.6875em.
I'm using this code:
@media only screen and (max-width: 59.6875em) {
.custom-logo {
content: url("https://www.example.com/example/wp-content/uploads/Logo_Wide_2x.png");
width: 300px;
}
}
It works in Chrome but not Firefox.
I've tried adding :before and :after and adding an a
tag, as suggested on other answers, but none of that works.
Can anyone suggest what's wrong, and how I can get this to work on Firefox?
Here is the html:
div class="site-branding"
a href="https://www.example.com/example/aa00/" class="custom-logo-link" rel="home" itemprop="url"img src="https://www.example.com/example/aa00/wp-content/uploads/sites/2/2019/04/cropped-Logo_248_2x.png" class="custom-logo" alt="Seed" itemprop="logo" srcset="https://www.example.com/example/aa00/wp-content/uploads/sites/2/2019/04/cropped-Logo_248_2x.png 248w, https://www.example.com/example/aa00/wp-content/uploads/sites/2/2019/04/cropped-Logo_248_2x-150x150.png 150w" sizes="(max-width: 248px) 100vw, 248px" width="248" height="248"/a
/div
Topic theme-twenty-fifteen theme-customizer css Wordpress
Category Web