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>
?
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.
inline. Displays an element as an inline element (like <span>). Any height and width properties will have no effect.
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With