You are viewing limited content. For full access, please sign in.

Question

Question

Top and left align labels in a form

asked on July 3, 2017 • Show version history

I have a form with the label alignment set to top.  I would like to have some of the labels set to left.  I have tried the following javascript.

$('.left').removeClass('label-top');

$('.left').addClass('label-left');

 

Also tried this CSS:

.left label.cf-label {text-align:left;}

 

Thanks!

0 0

Replies

replied on July 3, 2017 • Show version history

Janice,

The problem you're having is that the layout is controlled by the display style inherited from the classes, not by the text alignment ("display:block;" vs "display:inline-block;").

When you set your fields to "Left" display it adds multiple styling attributes to the child elements that might take a lot more work to reproduce.

A better options might be to go the other way around:

  1. Set the form to "Left" instead of "Top"
  2. Add "top-align" to the custom css class for each element you want set up that way
  3. Add one of the following to the form's CSS
    /*Targets immediate children of the element*/
    /*Automatically overrides the other classes*/
    /*Will affect both the label AND the field*/
    .top-align > * {
      display:block;
    }
    
    /*Targets the label element specifically*/
    /*Requires "!important" to override other classes*/
    /*The field will keep the inline-block styling*/
    .top-align label {
      display:block !important;
    }

 

Either of those will give you the following results

You might still need to do some fine-tuning to get exactly what you want, but this will be a lot less work than changing it from "Top" to "Left" through CSS.

On a side note, I'd recommend avoiding any style changes using JavaScript/JQuery because those only occur when the form is loaded in a browser and won't apply on the resulting PDF/TIFF pages.

0 0
replied on June 10, 2024

I have tried both of these in the new forms designer and CANNOT get it to work.  I have the form set to left align and am applying the class top to the field I am testing on.



This one changes the css selector format, but not the form field...

0 0
replied on June 10, 2024

The CSS in this post only applies to the Classic Designer. The HTML/CSS for the new designer is drastically different, so you'll want to look for examples specifically for the (modern) Forms Layout Designer.

1 0
replied on June 10, 2024

UGH!  That sounds about right. :)  So far, I am out of luck, but will continue looking! Thanks!

0 0
replied on June 21, 2024

@Christa, please how can i remove  indentation in fields I find that all the output of my multiline field in my classic form is indented from the second line.

 

Please how can i remove the indent completely Am using classic form

0 0
replied on June 23, 2024

Hi Adeyemi,

Can you share a pic what it look like now and what you expect?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.