'More Stuff
It pro...">

How to prevent a newline from appearing at the end of an html input field?

<form>Label<input type="text" size="10"></form>'More Stuff<br> 

It produces:

enter image description here

How can I make the show β€œMore materials” on the same line as the input field, right after it:

enter image description here

+6
source share
3 answers

The <form> element is a block element .

You can use CSS to make the text float around it:

  <form style="display:inline;"><label>Label <input/></label></form> 

 Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, <form style="display:inline;"><label>Label <input/></label></form> sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. 
+10
source

<form> is the default block level element (things go below it). You could say something like <form style='display:inline'> and that will help. Or you can leave them to the left, like:

 <form style='float:left'>Label <input type="text" size="10"></form> <div style='float:left'>More stuff</div> 
+1
source

Besides the fact that the top solutions didn't help me, and if you also want to avoid using a form, you can use display: flex.

it worked for me

 <span style='display:flex;'>Label<input type="text" size="10">More Stuff</span> 
0
source

Source: https://habr.com/ru/post/905237/


All Articles