claudios claudios - 1 year ago 71
CSS Question

Proper way on putting images as sources in assets shopify

I've been stuck in showing custom social on top of shopify theme. I tried the

{{ 'icon.png' | asset_url }}
but it won't display. Instead when I check the element in the browser it automatically generates a style which is
display: none !important;
. I don't know where or what I'm missing.

Here's my code below:

<div id="smash-social" class="grid__item medium-up--two-fifths text-right">
<a href="" target="_blank">
{{ 'facebook-logo-button.png' | asset_url }}
<a href="" target="_blank">
{{ 'twitter-logo-button.png' | asset_url }}

Answer Source

Add the img_tag filter to generate an img HTML element complete with an alt attribute:

{{ 'facebook-logo-button.png' | asset_url | img_tag: 'facebook' }}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download