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

Question

Question

Forms - Unable to put fields side by side

asked on January 22, 2014

I am trying to put two fields side by side using the inline-block.  I am using the following CSS code ...

 

.one input {width: 50px;}
.two input {width: 50px;}
.one input, .two input {display: inline-block;}

 

The one and two classes are successfully targeted and the widths are changed to 50px.  However, the classes are not displayed side by side.  They are displayed in their default.

 

 

 

Answer

APPROVED ANSWER
replied on January 22, 2014 Show version history

You don't need to specify the input element. Try this

 

.one, .two {display:inline-block;}

You could also add the same class to both fields, and further simplify the CSS selector. There's more information about using CSS with Forms on this page of the online help.

replied on January 22, 2014

That worked!

 

Thank you!

Replies

replied on January 22, 2014

You might try doing a Ctrl+F5 when viewing the page. This will reload all of the CSS and code on the page. It might be cached.

replied on January 22, 2014

I tried it and still no change.

 

Thank you

replied on March 28, 2014

Hi,

 

I am trying to display multiple rows of two columns of fields on a Laserfiche Form where all the fields on the form are unique, so it does not lend itself to using a table, and crucially for neatness each of the following in all rows are left-aligned:

 

  • Column 1 label text
  • Column 1 Field
  • Column 2 label text
  • Column 2 Field

 

See the example image attached.

 

I have been trying without success to use the CSS {display:inline-block;} notation to achieve this, see example below:

 

#q3, #q4 {display: inline-block; width: 100px;}

 

Can anyone assist me with the CSS I need to achieve my objective?

 

Many thanks.

 

John.

Laserfiche Forms Two Columns Left-Aligned Fields3.png
replied on March 28, 2014 Show version history

I found it easiest to do this by creating two non-repeatable collections (one for each column) that contain the fields you want to display side-by-side. I created a bunch of single line fields with default settings and used the following CSS to achieve a layout like your screenshot.

.cf-collection-block {display:inline-block; width:50%}
.cf-label {width: 195px!important;}
.cf-field {width:35%!important; float:right;}
.cf-medium {width:100%;}

This example keeps a uniform size for input boxes. If you want them to have varying widths, you'll need to style them individually.

 

Keep in mind that, when you're adjusting the width of fields, each field has several components: a field container, a label, an input box container, and an input box. See this help topic for more information.

replied on April 2, 2014

I have tried a slightly modified version of your suggested CSS (see below) because I want to use large field widths as opposed to medium field widths.

 

.cf-collection-block {display:inline-block; width:50%}
.cf-label {width: 120px!important;}
.cf-field {width:35%!important; float:right;}
.cf-large {width:100%;}

 

The problem I have is that the input fields are some distance from the label text causing there to be a lot of whitespace on the form and also causing the field display widths to appear very short (see attached image).

 

What I would like is for the input fields to be as near as possible to the label text, all still columnly left-aligined, which may also increase the display width lengths of the input fields. How can I achieve this?

 

Many thanks

Laserfiche Forms Two Columns Left-Aligned Fields Little Whitespace Large Input Fields.png
replied on April 2, 2014

If you do not want the labels and input boxes for each column to have the same amount of space (all labels are 120px wide, all input boxes are also a fixed width) then you'll need to style those widths individually.
 

replied on April 29, 2014

The issue mentioned by John Theophilus was resolved in a support case by altering the CSS that was used in the form.

You are not allowed to follow up in this post.