What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How to make radio items match width of their labels

    Asked by MeetingHabits on December 27, 2016 at 11:04 AM

    Hello, 

    I searched the form and tried the CSS editor for a while with no luck.  How can i make the width of my radio-items auto-adjust to match the size of the label.  See attached. 

    Thanks a ton!

  • Profile Image
    JotForm Support

    Answered by ashwin_d on December 27, 2016 at 11:22 AM

    Hello MeetingHabits,

    Please inject the following custom css code in form and see if that solves your problem:

    span.form-radio-item {

        width: 120px !important;

    }

    The following guide should help you how to inject custom css code in form:  https://www.jotform.com/help/117-How-to-Inject-Custom-CSS-Codes 

    The output of the above css is:

     

    Hope this helps.

    Do get back to us if you have any questions.

    Thank you!

  • Profile Image

    Answered by MeetingHabits on December 27, 2016 at 11:32 AM

    Hi Ashwin, Thanks for the quick answer.  Unfortunately, that doesn't work (it then screws up other fields (image below).

    Is there any way to make the widths auto-adjust to the text?  

    If not, is there code I can use to set sizes for individual items? 

     

    Thanks!

    -Lee

  • Profile Image

    Answered by Ian on December 27, 2016 at 11:33 AM

    Apart from what my colleague suggested, there is one more way to achieve this.

    As it appears to me that you are not looking for fix width of the radio fields so you can also opt to paste the following code in the INJECT CSS section :

    .form-radio-item{
    width: auto;
    padding-right: 15px;
    }

    This should affect all the radio fields on the form.

    Let us know if you have more questions.

  • Profile Image

    Answered by MeetingHabits on December 27, 2016 at 11:53 AM

    Hi Ian, 

    Thanks for chiming in!!!  I've injected the CSS.  It looks great in the Advanced CSS editor preview but that doesn't carry over to the live form.  Any ideas? 

    As an FYI - i'm planning to eventually embed into a webpage using your embed code (the first option with javascript code). 

    Thanks again!

    P.s. I opened in a new browser so it shouldn'd be the browser cache. 

  • Profile Image
    JotForm Support

    Answered by Mike on December 27, 2016 at 12:02 PM

    Please try with an !important statement.

    .form-radio-item{
    width: auto !important;
    padding-right: 15px;
    }

    Thank you.

  • Profile Image

    Answered by MeetingHabits on December 27, 2016 at 12:51 PM

    Thanks, Mike.  That did the trick.  You guys rock!