Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display HTML <FORM> as inline element?

Tags:

html

css

This is probably a basic html/css question...

I have a simple one-button form that I would like to display inline inside paragraph text.

<p>Read this sentence       <form style='display:inline;'>      <input style='display:inline;'              type='submit'              value='or push this button'/>      </form>. </p> 

Even though form has style=display:inline attribute, I get a linebreak before the form. Is there a way to get rid of it?

Can form elements appear inside <p>?

like image 351
Evgeny Avatar asked Jul 09 '09 22:07

Evgeny


People also ask

How do you create an inline element in HTML?

An inline element does not start on a new line. An inline element only takes up as much width as necessary. This is a <span> element inside a paragraph.

What is HTML display inline?

inline. Displays an element as an inline element (like <span>). Any height and width properties will have no effect.

How do you change an element to an inline?

You can set a block-level element to display like an inline element by setting the display property to inline. You can also cause inline elements to behave like block-level elements using the display property.


1 Answers

Move your form tag just outside the paragraph and set margins / padding to zero:

<form style="margin: 0; padding: 0;">   <p>     Read this sentence      <input style="display: inline;" type="submit" value="or push this button" />   </p> </form> 
like image 137
ChssPly76 Avatar answered Sep 28 '22 22:09

ChssPly76