How do I style so that the input box stays on the same line as the label? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I style so that the input box stays on the same line as the label?

In CSS, when I use "flex-direction=column" the input box appears below the label. <label>First name <input type="text" name="firstName"> </label>. How do I get the input box to stay on the same line as the label using CSS?

27th Oct 2018, 3:16 PM
Stan Berger
Stan Berger - avatar
4 Answers
+ 3
why are you using the flex-direction property?? label and input elements are inherently inline so no css is needed to have them appear on the same line.
28th Oct 2018, 2:47 PM
Lisa F
Lisa F - avatar
+ 3
use the size attribute in your input element to change the sizes of the input boxes. https://www.w3schools.com/tags/att_input_size.asp
29th Oct 2018, 12:27 PM
Lisa F
Lisa F - avatar
+ 1
Thanks. I reviewed that and understand now!
29th Oct 2018, 4:39 PM
Stan Berger
Stan Berger - avatar
0
I want to have a long name input box and a short age box
28th Oct 2018, 2:53 PM
Stan Berger
Stan Berger - avatar