I'm looking to change the logo on my header on a mobile. This is the code from the current header that shows up on both the desktop and the mobile (on desktop it's the link back to the home screen). Is there any easy way of changing it on just the mobile version?
HTML:
<div id="mainlogo">
<a class="main logo" href="http://sheisbiddy.com/home/" title="Main Logo" alt="main logo">
<img src="http://sheisbiddy.com/wp-content/uploads/2016/01/SHEISBIDDY-main-logo-smaller-6.png" border="0" alt="" />
</a>
CSS:
#mainlogo {text-align:center;}
Appreciate it guys!
The procedure is simple. Log in to your WordPress dashboard and go to Appearance > Customize. After you click on the WordPress Theme Customizer and open it, you will see all the options in the left-hand menu. There might be some variations in the options that are offered depending on the theme you're using.
You can use a media query and selectively show/hide elements. Your html would have both logos in the markup, and your CSS would define which logo is shown depending on screen size.
For example:
<style>
/* hide mobile version by default */
.logo .mobile {
display: none;
}
/* when screen is less than 600px wide
show mobile version and hide desktop */
@media (max-width: 600px) {
.logo .mobile {
display: block;
}
.logo .desktop {
display: none;
}
}
</style>
<div class="logo">
<img src="/images/logo_desktop.png" class="desktop" />
<img src="/images/logo_mobile.png" class="mobile />
</div>
If you are using Bootstrap then I have a very simple solution by only using a few Bootstrap classes :
<div id="mainlogo">
<img src="/images/logo_desktop.png" class="d-none d-lg-block" />
<img src="/images/logo_mobile.png" class="d-lg-none" />
</div>
You can see the details here: https://getbootstrap.com/docs/4.0/utilities/display/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With