How to center images on Image picker widget ?

  • ConsultCenter
    Asked on March 21, 2019 at 10:33 PM

    The images look more centered on the desktop and tablet views but the phone images are not centered.  Is there a CSS that I can insert that will address this issue?

    1553221992Screen Shot 2019 03 21 at 8 Screenshot 10

  • Mertkan JotForm Developer
    Replied on March 22, 2019 at 2:23 AM

    Please follow these steps:

    On your form builder, click on the blue form designer icon on the top right corner.  After that, click on the CSS Tab and make sure to paste your code then click on save button.

    How to center images on Image picker widget ? Image 10

     

    1. Inject the following custom CSS codes in your form:

    @media only screen and (max-device-width: 768px) {

    .custom-field-frame {

        width: 100% !important;

    }

    }

    2. Inject the following custom CSS codes in the Image picker widget:

    @media only screen and (max-device-width: 768px) {

    .imageContainer.blocks {

        width: 45% !important;

    }

    .divimg {

        width: 150px !important;

        height: 150px !important;

    }

     

    }

    Please check the GIF is shown below:

    How to center images on Image picker widget ? Image 21

     

     

    Last view on mobile:

    1553236783Screen Shot 2019 03 22 at 9 Screenshot 32

     

    For detailed information, please check the following guide: https://www.jotform.com/help/117-How-to-Inject-Custom-CSS-Codes

    If you have other questions or concerns, please do not hesitate to let us know.

  • Thomas Peebles
    Replied on March 22, 2019 at 2:53 AM

    I injected the code as shown and I still have only one column on my mobile view and it is off center.  Please advise if the CSS code needs to be in a specific section of the existing code for the form. 

    Thanks

  • BJoanna
    Replied on March 22, 2019 at 3:41 AM

    The first CSS code has to be added to the Form Designer > CSS tab.

    @media only screen and (max-device-width: 768px) {

    .custom-field-frame {

        width: 100% !important;

    }

    }

    You can add the code to the bottom of existing codes.

    1553240004css Screenshot 10

    The other CSS code has to be added to the widget's CSS tab.

    @media only screen and (max-device-width: 768px) {

    .imageContainer.blocks {

        width: 45% !important;

    }

    .divimg {

        width: 150px !important;

        height: 150px !important;

    }

    }

    1553240176widget Screenshot 21

    This should be the result.


    1553240324mobile Screenshot 32

    Here is a demo form - https://form.jotform.com/90801903605957


    Test it on an actual mobile device, not in the Preview mode. 

  • ConsultCenter
    Replied on March 22, 2019 at 10:24 PM

    Thanks for helping with this.  It does work as you describe but when I embed the form into my website using embed code it doesn't work.  Also with the solution you presented is there a way to have the two columns centered on the mobile device screens

    Thanks

  • roneet
    Replied on March 23, 2019 at 3:59 AM

    Could you please let us know the URL of the website where you are trying to embed the Form?

    I have injected CSS to center align the Image widget in the mobile

    #container {
     position: relative;
     left: 10px;
    }

    Let us know how it goes.

    Thanks.

  • ConsultCenter
    Replied on March 23, 2019 at 8:35 PM
  • Mike_G JotForm Support
    Replied on March 24, 2019 at 12:37 AM

    Thank you for providing us the link to the website where your form with the Image Picker widget is embedded.

    Please give me some time. I'll work on a solution and I'll get back to you as soon as possible.

  • Mike_G JotForm Support
    Replied on March 25, 2019 at 9:23 PM

    Apologies for any delays.

    Below are the CSS codes that you need to inject to your form to meet your requirements.

    @media screen and (max-device-width: 40em) {

    .form-line {

        padding: 2% 1px !important;

    }

    .form-all {

        width: 100% !important;

    }

    }

    1553563149t21 18 11 Screenshot 10

    How-to-Inject-Custom-CSS-Codes

    And below are the CSS codes that you need to inject to the custom CSS tab of the Image Picker widget in your form.

    @media screen and (max-device-width: 40em) {

    .imageContainer.blocks {

        margin-right: 0px !important;

        width: 48% !important;

    }

    .imageContainer.blocks:nth-child(odd) {

        margin-right: 4% !important;

    }

    .imageContainer.blocks:nth-child(even) {

        float: right;

    }

    }

    1553563309t21 21 09 Screenshot 21

    How-to-Inject-CSS-Codes-to-Widgets

    Please test the result with an actual mobile device. If you encounter any issues, please feel free to let us know and give us more details such as a screenshot that shows the issue.

    How-to-Post-Screenshots-to-Our-Support-Forum