How to Prevent Newline At the End of HTML Input Field

How to prevent newline at the end of html input field?

A <form> element is a block element.

You can use CSS to make text float around it:

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

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

How to prevent newline/line break within a form/form?

Include the table before your form tag or use try using below CSS:

<style type="text/css">
form, table {
display:inline;
margin:0px;
padding:0px;
}
</style>

Prevent form line break between two form tags

form {
display: inline;
}

clear HTML input after enter and prevent new line

Just return false when enter is pressed:

input.keydown(function(e) {
if (e.keyCode == 13) {
e.preventDefault();
$(this).val('');
return false;
}
}

Of course this means that your end-user won't be able to actually create a new line. In this case I usually have a boolean variable that changes when the shift key is pressed/released. So if shift is down, don't submit, make a new line.

How do I remove the line break between two input tags?

div{  display:inline-block}
input,button { width: 30px; height: 30px; background-color: #aaa; color: white; border: none;}
 <td colspan="1" style="width:1%;padding-left:50px;">        <div>            <input  type="submit" name="btnEdit" id="btnEdit" class="btn btn-success" style="width:50px;" value="Edit" />            <input  type="submit" name="btnEdit" id="btnDel" class="btn btn-success" style="width:50px;" value="Del" />        <button type="submit" name="btnEdit" id="btnEdit" class="btn btn-success" style="width:50px;">Edit</button>        <button type="submit" name="btnDel"  id="btnDel" class="btn btn-danger" style="width:50px;">Del</button>        </div>    </td>

input element won't break to new line; stays on same line with another input

input elements are by default inline elements. This means they will share the same line, unless acted upon by another condition.

Just change the inputs to block elements, and each will have their own line.

Add this to your CSS:

input { display: block; }

DEMO: http://jsfiddle.net/yt6joz9j/


UPDATE (based on comments)

To keep the form centered, just use a flexbox. Remove the code above and make this adjustment:

#portal-central-login form {
/* display: inline-block; */
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

DEMO: http://jsfiddle.net/yt6joz9j/1/

no line break between button and form

Use this CSS style: style="display: inline;" on your form.

<form action="/search" method="get" style="display: inline;">

Here's a demo on JSBin.

How to break words on an input field so it starts a new line once the width of the field is reached?