Why is my variant selector not centered on some product pages?

Solved

Why is my variant selector not centered on some product pages?

Modico
Explorer
50 3 12

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:

2023-07-08 (2).png

 

False:

2023-07-08 (3).png

 

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!

Accepted Solutions (4)
webwondersco
Shopify Partner
1200 171 174

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;
}
Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram

View solution in original post

webwondersco
Shopify Partner
1200 171 174

This is an accepted solution.

PLease try by adding this,

 

.product-form__input{
margin-left: auto !important;
margin-right: auto !important;
}
Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram

View solution in original post

webwondersco
Shopify Partner
1200 171 174

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.

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram

View solution in original post

webwondersco
Shopify Partner
1200 171 174

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

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram

View solution in original post

Replies 31 (31)

webwondersco
Shopify Partner
1200 171 174

Hey @Modico , I hope you are doing well.

 

could you please share your store URL? so, I can check and guide you accordingly. 

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12
webwondersco
Shopify Partner
1200 171 174

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;
}
Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

Hey @webwondersco

It didn't work, any ideas why?

Thanks for your efforts.

webwondersco
Shopify Partner
1200 171 174

This is an accepted solution.

PLease try by adding this,

 

.product-form__input{
margin-left: auto !important;
margin-right: auto !important;
}
Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

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!

Modico
Explorer
50 3 12

*work

webwondersco
Shopify Partner
1200 171 174

@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.

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

IMG_0557.jpeg

webwondersco
Shopify Partner
1200 171 174

@Modico , I have added from inspect element and it is working fine. see the screenshot

 

webwondersco_0-1688905422574.png

 

you have added in base.css file but it is not rendered in your style. try to add in different css file.

 

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

@webwondersco  ok I try some other files

webwondersco
Shopify Partner
1200 171 174

@Modico , let me know if you are still facing the issue.

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

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

webwondersco
Shopify Partner
1200 171 174

@Modico , yeah sure.

 

you can share the screenshot of the issue I'll try to help you in all possible ways.

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

@webwondersco okay, give me 30min and i'll explain you my issue with screenshots

Modico
Explorer
50 3 12

So I want to make a Inline Border for this text block.

 

Thats how its looking

555eb689-ba92-4db9-bfaa-d35e2eb391b1.jpg

 

this is how I want it to look

Design ohne Titel (2).png

 

 

this text is the text that I tried to put into the custom css

8d9a13b3-b99d-40e9-8555-ff0f9c541b43.jpg

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

8cc0d248-6022-4861-ad66-9d3676b297e4.jpg

 

Desktop

555eb689-ba92-4db9-bfaa-d35e2eb391b1.jpg

 

AFTER

 

Mobile

0f83d979-4d9d-4a1d-bb4d-7e3d4c761164.jpg

 

Desktop

e9dc6bea-0f08-4f6f-9d0d-1c0b92090555.jpg

 

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

webwondersco
Shopify Partner
1200 171 174

Okay, could you please add such a section on your website with text? So, I can check and provide the CSS

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

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.

Modico
Explorer
50 3 12

@webwondersco it's now online and actualy it's almost done so you can take your time I'm gonna leave it like this

webwondersco
Shopify Partner
1200 171 174

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.

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

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?

Modico
Explorer
50 3 12

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;
}

 

 

webwondersco
Shopify Partner
1200 171 174

@Modico , could you explain in details?

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

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.

webwondersco
Shopify Partner
1200 171 174

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

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

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
Explorer
50 3 12

@webwondersco 

I think I found it out:

@media (min-width: 750px) {

 

}

webwondersco
Shopify Partner
1200 171 174

@Modico , yes right. min-width is correct

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

@webwonderscoso max 749 is every mobile phone and min 750 is everything else so laptop, Ipad, computer, etc. They are all the same?

webwondersco
Shopify Partner
1200 171 174

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 

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
- a small Coffee Tip would be greatly appreciated. :)..! Instagram
Modico
Explorer
50 3 12

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 %}