kahna9
kahna9

Reputation: 35

why there is new line automatically after & before form tags in HTML?

When i make a form tag then its input and button come under the current line.And when i write sentence or make a button after form tag then it come under the form tag. i don't want to display input and button on new line. Demo of my code is here.

  <form name="apple">
<input max="10000" maxlength="4" min="0" name="banana" size="4" type="number" />
   <input onclick="increase ();" type="button" value="View" /></form>
<button onclick="startDownload()">Download</button>

Upvotes: 0

Views: 1769

Answers (2)

Benten
Benten

Reputation: 1039

It's because form has a display of block. To have everything go on the same line use this:

<form name="apple" style = "display:inline">
<input max="10000" maxlength="4" min="0" name="banana" size="4" type="number" />
<input onclick="increase ();" type="button" value="View" /></form>
<button onclick="startDownload()">Download</button>

Upvotes: 4

mitchimus
mitchimus

Reputation: 828

Try this

<form name="apple">
<input max="10000" maxlength="4" min="0" name="banana" size="4" type="number" />
<input onclick="increase ();" type="button" value="View" />
<button onclick="startDownload()">Download</button>
</form>

You had the button outside your form.

Upvotes: 1

Related Questions