Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello Everyone
I have recently centered the Variant Selector on my product page. Now I have the following problem, which you can see in the 2 pictures below. On some product pages it works. However, on others it is no longer left but also not centered it is in between and I don't know what the reason could be. I hope someone can help me with this.
Correct:
False:
By the way: Exactly half of my products look good as in first picture and the other half looks bad as in second picture, as I said I have no clue why this is like that, but I hope someone does and this person can help me.
Thank you in advance!
Solved! Go to the solution
This is an accepted solution.
@Modico , Please add the below line of CSS code at the end of your base.css file.
body .product-form__input{
margin-inline: auto;
}
This is an accepted solution.
PLease try by adding this,
.product-form__input{
margin-left: auto !important;
margin-right: auto !important;
}
This is an accepted solution.
@Modico, please add the below line of CSS to make it possible.
body .ImageHero__Block{
outline: 2px solid #000;
outline-offset: -10px;
}
let me know if you have any issues with this.
This is an accepted solution.
@Modico, oh so you want your code will work in mobile layout only.
just add your custom CSS to the media query. please check below
@media(max-width:749px){
//paste your custom CSS here
}
hope you get an idea from above
Hey @Modico , I hope you are doing well.
could you please share your store URL? so, I can check and guide you accordingly.
This is an accepted solution.
@Modico , Please add the below line of CSS code at the end of your base.css file.
body .product-form__input{
margin-inline: auto;
}
This is an accepted solution.
PLease try by adding this,
.product-form__input{
margin-left: auto !important;
margin-right: auto !important;
}
Hey @webwondersco
It still doesn't, maybe it's because of something that I added erlier? You have any other ideas how to maybe fix it? Again thank you very much for trying to help me!
*work
@Modico , could you please share the screenshot of CSS you have added in the theme?
I just want to check how you have added and in which file you have added.
@Modico , I have added from inspect element and it is working fine. see the screenshot
you have added in base.css file but it is not rendered in your style. try to add in different css file.
@Modico , let me know if you are still facing the issue.
Hey @webwondersco
I put it in component-price.css and now it and looks good! Thank you very much for the efforts! Now my other issue in my paralel post centering add to cart button is still not fixed, so if you have the time and desire you could please also help me with fixing the other issue, if you want.
Thanks in advance!
Modico
@Modico , yeah sure.
you can share the screenshot of the issue I'll try to help you in all possible ways.
@webwondersco okay, give me 30min and i'll explain you my issue with screenshots
So I want to make a Inline Border for this text block.
Thats how its looking
this is how I want it to look
this text is the text that I tried to put into the custom css
its for a outline but I just put it to minus, but it didnt work, the only thing that did work was "black dotted" instead of just "black" but I dont want dottes.
then I also want to have a differnt placing
NOW
Mobile
Desktop
AFTER
Mobile
Desktop
Let me know if this is to much, but I would still be very happy if you could only fix one thing like placing or inline border.
Thanks in Advance!
Modico
Okay, could you please add such a section on your website with text? So, I can check and provide the CSS
Hey @webwondersco
Yeah so this is actually only a preview because I'm planning to change theme to a premium theme. I'm gonna upload the preview theme so could you please contact me as fast as possible when I can upload my normal theme again? Because my preview is still not finished.
@webwondersco it's now online and actualy it's almost done so you can take your time I'm gonna leave it like this
This is an accepted solution.
@Modico, please add the below line of CSS to make it possible.
body .ImageHero__Block{
outline: 2px solid #000;
outline-offset: -10px;
}
let me know if you have any issues with this.
Hey @webwondersco
Sorry for my late respons but I think when it's night time where I live it's day where you live so we always miss each other.😂 I tried to put the code into the custom css and it didn't work but then I put it into the <style></style> tag in the image-with-text-block.liquid file and it worked! Looks amazing, Thank you so much! Do you have an idea how I could also change the placement of the text-block on mobile and desktop?
Hey @webwondersco
I found out how I can move it. How I did you can see below, but there's a new problem because on Desktop it looks good now but I would like to have a different placement on mobile and also I would like to have a different font-size for mobile in my slideshow, do you know how I can specify something for mobile? I think it's @media 750px or something like that but I'm not sure.
Here is the Code I used if you want to know:
/*FIRST IMAGE-WITH-BLOCK*/
.ImageHero__Wrapper {
position: absolute;
top: 50px;
right: 50px;
}
/*SECOND IMAGE-WITH-BLOCK*/
.ImageHero__Wrapper {
position: absolute;
bottom: 80px;
left: 40px;
}
@Modico , could you explain in details?
Yeah. sorry. I need code that I can put infront of something which makes it only for mobile. So for example I want a differnt Font-Size for mobile as for desktop. I think it's "@media and (750px..." but I'm not sure. And btw your code worked and for placement I found my own way. I hope you understand it's realy hard to explain.
This is an accepted solution.
@Modico, oh so you want your code will work in mobile layout only.
just add your custom CSS to the media query. please check below
@media(max-width:749px){
//paste your custom CSS here
}
hope you get an idea from above
Hey @webwondersco
Okay Thank you, I'll try when I'm back on my Laptop. Quick Question what would it be for Desktop? Just 1199px instead of 749px? And do we also distingiush between Desktop, Mobile and Tablet or Laptop? Or is it just Mobile / Desktop?
@Modico , yes right. min-width is correct
@webwonderscoso max 749 is every mobile phone and min 750 is everything else so laptop, Ipad, computer, etc. They are all the same?
no @Modico,
min-width 749px is for ipad devices and min-width 1200px is for computer or laptop
and if you want some different layout fir mac large screen then you can use min-width 1600px
Hey @webwondersco
Ok, Thank you. Would it be possible to have a differnt image for Mobile then Desktop for this section? It's a image-with-text-block. If it would be possible then here are the 2. Files I found who belong to it (image-with-text-block.liquid and image-with-text-overlay.liquid):
1. image-with-text-block.liquid
<section class="Section" id="section-{{ section.id }}" data-section-id="{{ section.id }}" data-section-type="image-with-text-block">
{%- capture mobile_size -%}750x{% if section.settings.image.height >= 960 %}960{% else %}{{ section.settings.image.height }}{% endif %}{%- endcapture -%}
<div class="FlexboxIeFix">
<div class="ImageHero ImageHero--large" {% if section.settings.image %}style="background: url({{ section.settings.image | img_url: '1x1', format: 'pjpg' }})"{% endif %}>
<div class="ImageHero__ImageWrapper">
<div class="ImageHero__Image Image--lazyLoad Image--zoomOut {% if section.settings.show_parallax %}ImageHero__Image--parallax{% endif %}"
data-optimumx="1.4"
data-expand="-150"
{% if section.settings.image %}data-bgset="{{ section.settings.image | img_url: mobile_size, crop: 'center' }} 750w, {{ section.settings.image | img_url: '1000x' }} 1000w, {{ section.settings.image | img_url: '1500x' }} 1500w"{% endif %}>
</div>
<noscript>
<div class="ImageHero__ImageWrapper" style="background-image: url({{ section.settings.image | img_url: '1000x' }})"></div>
</noscript>
{%- unless section.settings.image != blank -%}
<div class="PlaceholderBackground PlaceholderBackground--Dark">
{{ 'lifestyle-1' | placeholder_svg_tag: 'PlaceholderBackground__Svg' }}
</div>
{%- endunless -%}
</div>
{%- if section.settings.title != blank or section.settings.content != blank or section.settings.button_label != blank -%}
<div class="ImageHero__Wrapper">
<div class="ImageHero__Block ImageHero__Block--{{ section.settings.block_size }}">
{%- if section.settings.title != blank -%}
<h3 class="ImageHero__BlockHeading Heading u-h6">{{ section.settings.title | escape }}</h3>
{%- endif -%}
{%- if section.settings.content != blank -%}
<div class="ImageHero__BlockContent Rte">
{{ section.settings.content }}
</div>
{%- endif -%}
{%- if section.settings.button_label != blank -%}
<a href="{{ section.settings.button_link }}" class="ImageHero__BlockLink Link Link--underline">{{ section.settings.button_label | escape }}</a>
{%- endif -%}
</div>
</div>
{%- endif -%}
</div>
</div>
</section>
<style>
#section-{{ section.id }},
#section-{{ section.id }} .Heading {
color: {{ section.settings.text_color }};
}
#section-{{ section.id }} .ImageHero__Block {
background: {{ section.settings.background }};
}
body .ImageHero__Block{
outline: 2px solid #000;
outline-offset: -10px;
}
</style>
{% schema %}
{
"name": "Image with text block",
"settings": [
{
"type": "image_picker",
"id": "image",
"label": "Image",
"info": "1500 x 800px jpg recommended"
},
{
"type": "color",
"id": "background",
"label": "Background",
"default": "#ffffff"
},
{
"type": "color",
"id": "text_color",
"label": "Text",
"default": "#1c1b1b"
},
{
"type": "select",
"id": "block_size",
"label": "Block size",
"options": [
{
"value": "small",
"label": "Small"
},
{
"value": "normal",
"label": "Normal"
},
{
"value": "large",
"label": "Large"
}
],
"default": "small"
},
{
"type": "text",
"id": "title",
"label": "Heading",
"default": "Your story"
},
{
"type": "richtext",
"id": "content",
"label": "Text",
"default": "<p>Add your own custom content to give more information about your store, availability details...</p>"
},
{
"type": "text",
"id": "button_label",
"label": "Button label"
},
{
"type": "url",
"id": "button_link",
"label": "Button link"
},
{
"type": "checkbox",
"id": "show_parallax",
"label": "Show parallax scrolling effect",
"info": "Only applies to desktop.",
"default": true
}
],
"presets": [
{
"category": "Image",
"name": "Image with text block",
"settings": {}
}
]
}
{% endschema %}
2. image-with-text-overlay.liquid:
<section id="section-{{ section.id }}">
{%- capture mobile_size -%}750x{% if section.settings.image.height >= 960 %}960{% else %}{{ section.settings.image.height }}{% endif %}{%- endcapture -%}
<div class="FlexboxIeFix">
<div class="ImageHero {% if section.settings.section_size != 'normal' %}ImageHero--{{ section.settings.section_size }}{% endif %}" {% if section.settings.image %}style="background: url({{ section.settings.image | img_url: '1x1' }})"{% endif %}>
<div class="ImageHero__ImageWrapper">
<div class="ImageHero__Image {% if section.settings.overlay_opacity > 0 %}ImageHero__ImageWrapper--hasOverlay{% endif %} Image--lazyLoad Image--zoomOut"
data-optimumx="1.4"
data-expand="-150"
{% if section.settings.image %}data-bgset="{{ section.settings.image | img_url: mobile_size, crop: 'center' }} 750w, {{ section.settings.image | img_url: '1000x' }} 1000w, {{ section.settings.image | img_url: '1500x' }} 1500w"{% endif %}>
</div>
<noscript>
<div class="ImageHero__Image" style="background-image: url({{ section.settings.image | img_url: '1000x' }})"></div>
</noscript>
{%- unless section.settings.image != blank -%}
<div class="PlaceholderBackground PlaceholderBackground--Dark">
{{ 'lifestyle-1' | placeholder_svg_tag: 'PlaceholderBackground__Svg' }}
</div>
{%- endunless -%}
</div>
{%- if section.settings.subheading != blank or section.settings.title != blank or section.settings.content != blank -%}
<div class="ImageHero__ContentOverlay">
{%- if section.settings.subheading != blank or section.settings.title != blank -%}
<header class="SectionHeader">
{%- if section.settings.subheading != blank -%}
<h3 class="SectionHeader__SubHeading Heading u-h6">{{ section.settings.subheading | escape }}</h3>
{%- endif -%}
{%- if section.settings.title != blank -%}
<h2 class="SectionHeader__Heading Heading u-h1">{{ section.settings.title | escape }}</h2>
{%- endif -%}
{%- if section.settings.content != blank -%}
<div class="SectionHeader__Description">
{{ section.settings.content }}
</div>
{%- endif -%}
</header>
{%- endif -%}
</div>
{%- endif -%}
</div>
</div>
</section>
<style>
#section-{{ section.id }},
#section-{{ section.id }} .Heading {
color: {{ section.settings.text_color }};
}
#section-{{ section.id }} .ImageHero__ImageWrapper--hasOverlay::before {
{%- assign overlay_opacity = section.settings.overlay_opacity | divided_by: 100.0 -%}
background-color: {{ section.settings.overlay_color | color_modify: 'alpha', overlay_opacity }};
}
</style>
{% schema %}
{
"name": "Image with text overlay",
"settings": [
{
"type": "select",
"id": "section_size",
"label": "Section size",
"options": [
{
"value": "small",
"label": "Small"
},
{
"value": "normal",
"label": "Normal"
},
{
"value": "large",
"label": "Large"
}
],
"default": "large"
},
{
"type": "image_picker",
"id": "image",
"label": "Image",
"info": "1500 x 800px jpg recommended"
},
{
"type": "color",
"id": "text_color",
"label": "Text",
"default": "#ffffff"
},
{
"type": "color",
"id": "overlay_color",
"label": "Overlay",
"default": "#000000"
},
{
"type": "range",
"id": "overlay_opacity",
"label": "Overlay opacity",
"min": 0,
"max": 100,
"step": 1,
"unit": "%",
"default": 30
},
{
"type": "text",
"id": "subheading",
"label": "Sub-heading"
},
{
"type": "text",
"id": "title",
"label": "Heading",
"default": "Tell your story"
},
{
"type": "richtext",
"id": "content",
"label": "Text",
"default": "<p>Add your own custom content to give more information about your store, availability details...</p>"
}
],
"presets": [
{
"category": "Image",
"name": "Image with text (overlay)",
"settings": {}
}
]
}
{% endschema %}
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