Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I have 2 metafields I am including in a custom liquid block: One is a file (image) and one is rich-text.
I have figured out how to include both to make them functional and visible, but I want to put them on the same line.
When I add this code, they always separate into 2 lines:
<div style="width:17.5px">{{ product.metafields.custom.product_specs_icon_field | metafield_tag }}</div>
<div style="font-size:14px;">{{ product.metafields.custom.product_specs_field_ | metafield_tag }}</div>
Solved! Go to the solution
This is an accepted solution.
A simple solution is the add two divs inside another div block:
<div style="display:flex">
<div style="width:17.5px">{{ product.metafields.custom.product_specs_icon_field | metafield_tag }}</div>
<div style="font-size:14px;">{{ product.metafields.custom.product_specs_field_ | metafield_tag }}</div>
</div>
You might need to add other styling to the parent div depending how the content appears.
This is an accepted solution.
It is a bit difficult to comment without seeing your html code. Please refer this regarding flex positioning: Aligning items in a flex container - CSS: Cascading Style Sheets | MDN (mozilla.org)
This is an accepted solution.
A simple solution is the add two divs inside another div block:
<div style="display:flex">
<div style="width:17.5px">{{ product.metafields.custom.product_specs_icon_field | metafield_tag }}</div>
<div style="font-size:14px;">{{ product.metafields.custom.product_specs_field_ | metafield_tag }}</div>
</div>
You might need to add other styling to the parent div depending how the content appears.
That worked well!
If I wanted two lines of this code, how would I control the space between them?
I tried this, but a lot of space was added between the 2 lines:
<div style="display:flex;">
<div style="width:18px;">
{{ product.metafields.custom.product_specs_icon_field | metafield_tag }}</div>
<div style="font-size:14px;">{{ product.metafields.custom.product_specs_field_ | metafield_tag }}</div>
</div>
<div style="display:flex;">
<div style="width:18px;">
{{ product.metafields.custom.product_specs_icon_field | metafield_tag }}</div>
<div style="font-size:14px;">{{ product.metafields.custom.product_specs_field_ | metafield_tag }}</div>
</div>
This is an accepted solution.
It is a bit difficult to comment without seeing your html code. Please refer this regarding flex positioning: Aligning items in a flex container - CSS: Cascading Style Sheets | MDN (mozilla.org)
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024