How to display HTML form as an inline element?

Spread the love

To display HTML form as an inline element, we remove the padding and margin from the form element.

For instance, we write

<form style="margin: 0; padding: 0">
  <p>
    Read this sentence
    <input style="display: inline" type="submit" value="push this button" />
  </p>
</form>

to add a from and set the margin and padding to 0.

And we display the input as an inline element with display: inline.

Leave a Reply

Your email address will not be published. Required fields are marked *