Support » Theme: Responsive » How to use SVG logo with PNG fallback

  • In other WordPress themes, I’ve been able to use SVG logos with a fallback mechanism to display a PNG logo on older browsers and Android 2.3, etc., but I’m having difficulty making this work on the Responsive Theme.

    Why SVG Logo Files?
    SVG files are vector based and remain sharp at any size, but they don’t display on slightly older Android platforms and some older browsers…which is why we need a mechanism to fallback to PNG. (Most people are happy enough with PNG, but I like the vector-based sharpness of SVG, of course, especially for the logo.)

    Turning on SVG in WordPress
    In default mode, WordPress is not enabled to accept SVG files, but that option can be easily turned on via your theme’s functions.php file. For info on how to do that, see here: (

    So, I’ve turned on SVG capability in WordPress, and my SVG logo does display properly in the Responsive Theme when it is selected through the normal Responsive Theme (RT) options settings.

    Child Theme
    However, I want to also enable a PNG fallback image, and this means I need to edit the header.php and style.css files. I’ve set up a Responsive Child Theme, so I’m editing those files, not the original Responsive parent theme files, of course.

    The Fallback Method
    The fallback method involves defining a class in the stylesheet to implements two (or three) simultaneous transparent backgrounds with linear gradients inside a div tag (or other tag, I suppose). If your browser doesn’t support the SVG background, it will display the PNG fallback, and this works like a charm on older browsers and even Android 2.3 and below.

    For more info on the method, see the general discussion of several methods here (; this comment, which describes the method I’m using (, which is based on Pau Giner’s method (which I like a lot) (; and Giner’s demo (

    Giner’s method has worked for me on other themes, but for some reason I’m failing to get either the SVG or the PNG file to display under RT. There is probably just some small little detail under the Responsive Theme hood that is preventing this.

    Here’s what I’ve done so far:
    – Created RT-child theme
    – Created RT-child style.css and included the following class definition:

    .logofallback {
    background: transparent url( no-repeat;
    background-image: -webkit-linear-gradient(transparent, transparent), url(;
    background-image: linear-gradient(transparent, transparent), url(;

    – Created RT-child header.php file and added this code within the <div id=”logo”></div>
    <div class="logofallback"></div>

    End Result: No Image
    No logo image displays at all. However, when I right-click on the logo area of the page and choose “inspect element,” it clearly shows that the SVG logo image address was correctly loaded, and hovering over it in the inspector panel shows that the logo appears properly.

    So why won’t this method work here when it works in other themes? I’m thinking there might be some kind of conflict with some other Responsive Theme css rule…? Any suggestions much appreciated!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to use SVG logo with PNG fallback’ is closed to new replies.