Here is a snippet of my HTML code:
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="{{ route('home') }}">
<img src="{{ asset('assets/images/logo-school-icon.png') }}" alt="icon" width="50" height="50">
<img class="logo-school" src="{{ asset('assets/images/logo-school.png') }}" alt="logo">
</a>
</nav>
This is how my CSS looks like:
@media (max-width: 530px) {
.navbar-brand .logo-school {
background-image:url('assets/images/logo-school-mobile.png');
}
}
When accessed from desktop, the images displayed are logo-school-icon.png and logo-school.png.
On the other hand, if accessed from mobile devices, I want to show logo-school-icon.png and replace logo-school.png with logo-school-mobile.png.
I have attempted this approach, but it is not working as expected. When accessed from a mobile device, both images (logo-school.png and logo-school-mobile.png) still appear instead of just logo-school-icon.png and logo-school-mobile.png.
Can someone provide me with a solution to solve this issue?
Note: I am still looking for a resolution to this problem. Please make sure to understand my question properly before providing an answer. I appreciate any responses with a demo (HTML+CSS). Thank you.