Shopify themes, liquid, logos, and UX
Hi Community and Experts!
I am currently struggling with the following task:
I want to create a "Video with Text" section just like the "Image with Text" section. I found the following discussion where the Problem was solved, but no real solution was given: https://community.shopify.com/c/shopify-design/how-to-make-a-video-with-image-section-in-shopify/td-...
In the End it should look like this: https://myblend.se/pages/instructions
So, autoplay and loop as well.
I guess as stated in the discussion, duplicate the "Image with Text" section in the Section Folder in "Edit Code" and replace the Image code with video code. I cant figure out which is which and with what code to replace, the video.liquid code?
Edit: As well as add/configure an Asset .css
Thanks for the help!
Solved! Go to the solution
This is an accepted solution.
Hi everyone!
I hired a coder to do it since I couldn't fin anything helpful. Here you go:
Create a new section with this code, called "video-with-text.liquid"
{{ 'component-video-with-text.css' | asset_url | stylesheet_tag }}
<div class="video-with-text {% if section.settings.full_width %}video-with-text--full-width{% else %}page-width{% endif %} color-scheme-{{ section.settings.color_scheme }}">
<div class="video-with-text__grid color-{{ section.settings.color_scheme }} grid grid--gapless grid--1-col grid--2-col-tablet gradient{% if section.settings.layout == 'text_first' %} video-with-text__grid--reverse{% endif %}">
<div class="grid__item">
<div class="video-with-text__media image-with-text__media--{{ section.settings.height }} media">
<video style="max-width: 100%; height: 100%;" autoplay="autoplay" loop="loop" muted="" webkit-playsinline="" playsinline="">
<source src="{{ section.settings.video_url }}" type="video/mp4" />
</video>
</div>
</div>
<div class="grid__item">
<div class="video-with-text__content video-with-text__content--{{ section.settings.height }}">
{%- for block in section.blocks -%}
{% case block.type %}
{%- when 'heading' -%}
<h2 class="video-with-text__heading h1" {{ block.shopify_attributes }}>
{{ block.settings.heading | escape }}
</h2>
{%- when 'text' -%}
<div class="video-with-text__text rte" {{ block.shopify_attributes }}>{{ block.settings.text }}</div>
{%- when 'button' -%}
{%- if block.settings.button_label != blank -%}
<a{% if block.settings.button_link != blank %} href="{{ block.settings.button_link }}"{% endif %} class="button{% if block.settings.button_style_secondary %} button--secondary{% else %} button--primary{% endif %}"{% if block.settings.button_link == blank %} aria-disabled="true"{% endif %} {{ block.shopify_attributes }}>
{{ block.settings.button_label | escape }}
</a>
{%- endif -%}
{%- endcase -%}
{%- endfor -%}
</div>
</div>
</div>
</div>
{% schema %}
{
"name": "Video with text",
"class": "spaced-section spaced-section--full-width",
"settings": [
{
"type": "select",
"id": "color_scheme",
"options": [
{
"value": "background-1",
"label": "Background 1"
},
{
"value": "background-2",
"label": "Background 2"
},
{
"value": "inverse",
"label": "Inverse"
},
{
"value": "accent-1",
"label": "Accent 1"
},
{
"value": "accent-2",
"label": "Accent 2"
}
],
"default": "background-1",
"label": "Color scheme"
},
{
"type": "text",
"id": "video_url",
"default": "https://cdn.shopify.com/s/files/1/0050/2779/0919/files/1_1_Cutting_fruit_H.mp4?v=1603372350",
"label": "Video url",
"info": "Upload your video to Shopify then paste the url here"
},
{
"type": "select",
"id": "height",
"options": [
{
"value": "adapt",
"label": "Adapt"
},
{
"value": "small",
"label": "Small"
},
{
"value": "large",
"label": "Large"
}
],
"default": "adapt",
"label": "Video ratio"
},
{
"type": "select",
"id": "layout",
"options": [
{
"value": "image_first",
"label": "Video first"
},
{
"value": "text_first",
"label": "Text first"
}
],
"default": "image_first",
"label": "Desktop layout",
"info": "Video first is the default mobile layout."
}
],
"blocks": [
{
"type": "heading",
"name": "t:sections.video-with-text.blocks.heading.name",
"limit": 1,
"settings": [
{
"type": "text",
"id": "heading",
"default": "Image with text",
"label": "Heading"
}
]
},
{
"type": "text",
"name": "Text name",
"limit": 1,
"settings": [
{
"type": "richtext",
"id": "text",
"default": "<p>Pair text with an image to focus on your chosen product, collection, or blog post. Add details on availability, style, or even provide a review.</p>",
"label": "Description"
}
]
},
{
"type": "button",
"name": "Button name",
"limit": 1,
"settings": [
{
"type": "text",
"id": "button_label",
"default": "Button label",
"label": "Button label",
"info": "Leave the label blank to hide the button."
},
{
"type": "url",
"id": "button_link",
"label": "Button link"
}
]
}
],
"presets": [
{
"name": "Video with text",
"blocks": [
{
"type": "heading"
},
{
"type": "text"
},
{
"type": "button"
}
]
}
]
}
{% endschema %}
And create a new asset called "component-video-with-text.css" with this code:
.video-with-text {
margin-top: 5rem;
}
.video-with-text:not(.color-scheme-background-1) {
margin-bottom: 5rem;
}
@media screen and (min-width: 750px) {
.video-with-text {
margin-bottom: calc(5rem + var(--page-width-margin));
}
}
.video-with-text .grid {
margin-left: 0;
margin-bottom: 0;
}
.video-with-text__grid {
overflow: hidden;
}
@media screen and (min-width: 750px) {
.video-with-text__grid--reverse {
flex-direction: row-reverse;
}
}
.video-with-text__media {
background-color: transparent;
min-height: 100%;
}
.video-with-text__media--small {
height: 19.4rem;
}
.video-with-text__media--large {
height: 40rem;
}
@media screen and (min-width: 750px) {
.video-with-text__media--small {
height: 31.4rem;
}
.video-with-text__media--large {
height: 60rem;
}
}
.video-with-text__media--placeholder {
background-color: rgba(var(--color-foreground), 0.04);
position: relative;
overflow: hidden;
}
.video-with-text__media--placeholder.video-with-text__media--adapt {
height: 20rem;
}
@media screen and (min-width: 750px) {
.video-with-text__media--placeholder.video-with-text__media--adapt {
height: 30rem;
}
}
.video-with-text__media--placeholder > svg {
position: absolute;
left: 50%;
max-width: 80rem;
top: 50%;
transform: translate(-50%, -50%);
width: 100%;
fill: currentColor;
}
.video-with-text__content {
display: flex;
flex-direction: column;
align-items: flex-start;
height: 100%;
justify-content: center;
padding: 4rem calc(4rem / var(--font-body-scale)) 5rem;
}
@media screen and (min-width: 750px) {
.video-with-text__grid--reverse .video-with-text__content {
margin-left: auto;
}
}
@media screen and (min-width: 750px) {
.video-with-text__content {
padding: 6rem 7rem 7rem;
}
}
.video-with-text__content > * + * {
margin-top: 2rem;
}
.video-with-text__content > .video-with-text__text:empty ~ a {
margin-top: 2rem;
}
.video-with-text__content > :first-child:is(.video-with-text__heading) {
margin-top: 0;
}
.video-with-text__content :last-child:is(.video-with-text__heading) {
margin-bottom: 0;
}
.video-with-text__content .button + .video-with-text__text {
margin-top: 2rem;
}
.video-with-text__content .video-with-text__text + .button {
margin-top: 3rem;
}
.video-with-text__heading {
margin-bottom: 0;
}
.video-with-text__text p {
margin-top: 0;
margin-bottom: 1rem;
}
.video-with-text__content {
padding-left: 15px !important;
padding-right: 15px !important;
}
This is an accepted solution.
thanks for more details can you please try this code
1. Go to Online Store->Theme-> Edit code
2. Asset->/base.css ->paste below code at the bottom of the file.
@media screen and (max-width: 749px) {
.video-with-text video {
position: relative !important;
}
}
Thanks so much for sharing this!
Thank you
Thanks!!
Hi!!! This worked wonderfully however on mobile it is blank and any suggestions below did not work... can anyone help please?
Can't thank you enough for this!
If anyone is having the problem of the video not displaying on mobile just add this code to the bottom of the 'component-video-with-text.css' file:
@media screen and (max-width: 740px) {
.media>*:not(.zoom):not(.deferred-media__poster-button), .media model-viewer {
display: block;
position: relative;
}
}
Hey, I would like to ask which parts of the second code I have to change to adjust the video sizes on the deskopt. Thank you!
Hi. I have been following the steps to set this up in my new online store and I have managed to get the bugs out and have it showing on mobile thanks to the threads. It all looked really good, until I wanted to then add more sections into the page.
In total I have 4 video with text sections on my page. When I start the first video and then pause it to start the next video, it simply restarts my first section's video. That is a real problem that I need to resolve and ideally I'd like to have all of the videos have their own normal controls (ie volume control, stop, start, pause) without the play / pause buttons. Are you able to help with this?
hi @vincentdh can you please le me know which theme you using? for the myblend . please
Dawn Theme
The audio on the video with text doesn't work on my website, anyone know how to fix that?
@whereswaldo you'll need to go into the `video-with-text.liquid` file and add in a small piece of code.
Do a CTRL+F (or COMMAND+F) and search for "<video style" to see the line I'm referring to below. You'll want to add in the instructions
controls = "true"
this will allow the video controls to appear.
The whole line should look like this
<video style="max-width: 100%; height: 100%;" autoplay="autoplay" controls= "true" muted = "" loop="loop" webkit-playsinline="" playsinline="">
<source src="{{ section.settings.video_url }}" type="video/mp4" />
</video>
This code worked for desktop, but the video doesn't show up for mobile. 😞 Any ideas why?
👉Re: Dawn Theme - Sección de video con texto - Shopify Comunidad
Sorry to dig up an older thread, but is there a way to have videos without the text and use them in columns?
You can add only one video without text. Shopify provides you with a section where you can embed a YouTube video or upload your own.
You can modify that file to add multiple videos in the form of columns. You can find it in your code, it's called: video.liquid
Never mind! Solved it! I forgot a piece of code
Hi @xSeanx
Unfortunately, to have video in columns that would be a custom code and you will need to hire a developer to do so.
Easier Solution here:
This is amazing, thanks so much!
I am wishing to use a coloured background. Any insights on how to make the background colour the full width of the screen please?
Is it also possible in the "Refresh" Theme? I Tried the Code and its not working for me.
@SOE-Commerce yes pleas share your store url so i will check and update you
@KetanKumar Thanks for your help!
https://felligefreunde.com/products/katzenstreumatte
pass: bh77sas54
@SOE-Commerce thank for quick response
got it your point do you want video with text section at product page right?
do you want each product different video and text or same?
@KetanKumar yes and each product different video and text. Like the picture-text section but with a Video uploaded on shopify.
@SOE-Commerce thanks for confirm and clear your asap, yes its possible to make more customization code. if you want this please DM your details about more this customization code
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025