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)
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025