Viewing 10 replies - 1 through 10 (of 10 total)
  • Doing that with just css isn’t the best way, but if it must be done…Here is a super hacky way to achieve that with just css. As long as you have a path for the image you want to use, you can use the css background property.

    div.logo-wrapper {
        float: left;
        background-image: url('http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons-256…natural-wonders/054339-simple-red-glossy-icon-natural-wonders-flower2.png'); /* change the url to your image */
        background-size: contain;
        background-repeat: no-repeat;
        background-position-x: 149px; /* adjust accordingly for left and right position */
        background-position-y: 8px; /* adjust accordingly for up and down position */
        width: 35%; /* if image is really large you may have to adjust the width here, otherwise this should be fine */
        text-align: left;
    }
    Thread Starter dessy.raza

    (@dessyraza)

    Hmm, that didn’t seem to work

    where did you add the code?

    Thread Starter dessy.raza

    (@dessyraza)

    I added it in my custom css

    Thread Starter dessy.raza

    (@dessyraza)

    The only reason I use custom css is because the template itself won’t let me edit it.

    Im looking at your code and don’t see it in there anywhere.

    Thread Starter dessy.raza

    (@dessyraza)

    I deleted it after it didn’t work but just readded it now so you can see

    You’re getting a 404 error on the image that you’re using as the background, which means that the image file can’t be found, which is probably because of the ellipsis between icons-256 and natural-wonders (you can see it if you look at the original code that Mr Case posted).

    It was probably just a copy-and-paste mistake; you need to pass the full path to the image you’re trying to use.

    I see the code now. But you have to replace the url to the image you want to use. You just left what I had in there as an example.

    Thread Starter dessy.raza

    (@dessyraza)

    Got it! Thank you so much!! 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Adding PNG to WordPress via Custom CSS (Need code)’ is closed to new replies.