If I have a form with

<label>Label</label>
<input type="text"></input>

How do I make the label on a separate line from the inputs without adding a <br />?

I thought you can do it with css by making each element a block element, but I see people are making them on new lines without changing to block...

  • do you need the / in the br tag anymore? Numbers McPi over 7 years ago
  • What's wrong with using display:block? Abinadi Ayerdis over 7 years ago

2 answers

danwellman 5600
1
point
This was chosen as the best answer

You could also do it without explicitly setting them to display:block by floating them both left but adding clear:left to the input

Answered over 7 years ago by danwellman
1
point

The display property will work

http://www.w3schools.com/cssref/pr_class_display.asp for more info

if you use the "display: inline-block;" on both LABEL and INPUT they will be next to each other, id you use "display: block;" on both, the label will be on one line and the input on the next line.

Answered over 7 years ago by Eric (BookOfZeus)