I’m using SVG payment icons in the footer of my website. However, I want to inline them. I tried playing with the CSS but still nothing is happening. Currently, the icons are displayed as a list. How can I inline them?
Here’s the Footer code:
<footer class="page-footer variant4 fullboxed">
<div class="footer-bot">
<div class="container">
<div class="footer-nav">
<ul>
{% for link in linklists[settings.footer_nav]links %}
<li>{{ link.title | link_to: link.url }}</li>
{% endfor %}
</ul>
</div>
{% unless shop.enabled_payment_types == empty %}
{% assign payment_icons_available = 'amazon_payments,american_express,apple_pay,bitcoin,cirrus,dankort,diners_club,discover,dogecoin,dwolla,forbrugsforeningen,interac,jcb,litecoin,maestro,master,paypal,visa' | split: ',' %}
<div class="payment-icons">
{% for type in shop.enabled_payment_types %}
{% if payment_icons_available contains type %}
{% assign icon_name = type | prepend: 'icon-' %}
{% include icon_name %}
{% endif %}
{% endfor %}
</div>
</div>
{% endunless %}
</div>
</footer>
And here’s the CSS:
.payment-icons {
width: 50px;
margin: auto; !important;
}
2
Answers
You’re currently relying on the container of the SVG elements to control the width (50px) of each SVG, which makes it impossible for each SVG to flow next to each other. Adjust your CSS so that the container,
div.payment-icons
, can be 100% of the outer container and adjust each SVG element to specifically 50px width. From here, you can add additional CSS to space the SVG icons across the page:In order to perfectly space out your SVG icons, adjust your footer HTML so that each SVG icon has a list-item container:
Then include the following CSS:
Update, mobile:
Try adding:
I tested it on your website in the inspector and it worked.