Can’t align search bar on mobile properly

Forums › Forums › Search & Filter Pro › Can’t align search bar on mobile properly

Tagged: 

Viewing 6 posts – 1 through 6 (of 6 total)
  • Anonymous
    #262721

    Hi,

    Please check the following URL-
    https://mool-hatabo.co.il/

    I created a search bar to display only on PC & Tablets and added the following css:

    .searchandfilter[data-sf-form-id="160"] > ul > li {
    	display: inline-block;
    	vertical-align: top;
    	padding: 0 20px;
    }
    
    .searchandfilter[data-sf-form-id="160"] > ul {
        display: table;
        margin: 0 auto 10px;
    }
    
    .searchandfilter[data-sf-form-id="160"] > ul > li {
        padding: 0 12px 0 0;
    }

    Then, I duplicated it and created a new form to display only on mobile and added the following CSS-

    @media (min-width: 992px) {
      .searchandfilter[data-sf-form-id="224"] {
        display: inline-block;
        vertical-align: top;
        padding: 0 20px;
      }
    }
    

    I got 2 questions-
    A) How can I center the 2nd form (mobile) using css? (including the submit button)
    B) Is there a better way to do this or just duplicating the forms is okay?

    Thanks in advance.

    Trevor
    #262745

    Having a cloned form will potentially be an issue, as doing this (having more than one instance of the same form, or multiple different forms) will mean that they don’t work together and often will conflict with each other. Just be aware that this is possible (likely), so if you have problems with the results not working, that might be why. Normally, we suggest only one form instance on the results page.

    You CAN have more than one form on any page other than the results page.

    We are making some changes around this for V3, due in a few months.

    This:

    @media (min-width: 992px) {
      .searchandfilter[data-sf-form-id="224"] {
        display: inline-block;
        vertical-align: top;
        padding: 0 20px;
      }
    }

    Is code aimed at a desktop, it would look like this for mobile:

    @media (max-width: 991px) {
      .searchandfilter[data-sf-form-id="224"] {
        display: inline-block;
        vertical-align: top;
        padding: 0 20px;
      }
    }
    Anonymous
    #262814

    Hi,

    I managed to make it work with a clone form, just use different search bar & results one to display on desktop & tablets and the other one only on mobiles. Not ideal, but it works properly, I’ve checked multiple times.

    Thing is now the aligment is good but not perfect. The problem is only with the submit buttons. On desktop it should be a little bit higher and on mobile should be in the center.

    How can I fix that?

    Trevor
    #262820

    I didn’t check where your mobile CSS media breaks are, but for desktop alter the padding top and bottom is best, and this also centres the button for you.:

    .searchandfilter input[type=submit] {
        padding-top: 6px;
        padding-bottom: 6px;
    }
    @media (max-width: 767px) {
      .searchandfilter input[type=submit] {
        display: table;
        margin: 0 auto;
      }
    }
    Anonymous
    #262825

    It works perfectly, thank you so much! 🙂

    Trevor
    #262827

    Thanks for letting me know. I will close this thread for now.

Viewing 6 posts – 1 through 6 (of 6 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.