I have two images, logo.png
and logo-mobile.png
.
The logo is basically two words, one written in a colour and the other one in another colour. For simplicity let's call it "TwoWords", where "Two" is white for logo.png
and black on logo-mobile.png
whilst "Words" maintains the original blue colour in both logos.
The reason I do this is that on desktop I have a slideshow going on (I load the images using the css background-image: url("url/to/image.png")
for desktop) in the header where the logo is (no navigation bar as it's just a single page) whilst on mobile I don't want to load the slideshow (you know, 1MB per image or more), so I just set the background colour to white. Now if you remember what I said about logo.png
and how "Two" is in white, well... I can't use this as the logo since "Two" becomes unreadable, hence the second logo.
My first solution to this problem was quite simple really, I created a
<div class="heading-logo"></div>
and the css for it was
.heading-logo{
background-image: url("../images/logo.png");
}
whilst in the media query for mobile I change logo.png
with logo-mobile.png
. Problem solved, right? Wrong(ish)! I have the logo I want but I don't have an <img>
tag with an alt
attribute and a title
, so if someone disables the images they will see nothing!
Now we get to my second solution which I am currently using.
<div class="heading-logo">
<img class="image-logo" src="./images/transparent.png" alt="Two Words" title="Logo">
</div>`
Basically I'm loading a transparent image that "functions" as the logo when in reality the real logo is set as background for the div.
The last solution I am considering using is just creating two <img>
tags and hide/display them accordingly.
<div>
<img class="image-logo" src="./images/logo.png" alt="Two Words" title="Logo">
<img class="image-logo-mobile" src="./images/logo-mobile.png" alt="" title="">
</div>`
But this way I always load both logos, which is something I would like to avoid. At the same time the solution I am using too loads two images, so they are quite similar (but not really) although performance wise it's a tiny bit faster since transparent.png
weights less than both the logo images.
The question would be, which one would be the better solution SEO wise and also performance wise? When you have two logos, one for mobile and one for desktop, which one of the three solutions would be the better option?
I had a look at answers like this one which is basically my third approach (so is this one) or one that focuses more on the SEO aspect of the logo, but none answer directly my question.
Also if this is not the right place to ask this question let me know and I'll delete it.