I have two submit buttons part of two different forms, How can I display them in one common line and in the middle of the line side by side?
<form action="https://google.com/search">
<div style="display: inline;">
<input id="google" type="text" name="q">
<input class="button" type="submit" value="Google Search">
</div>
</form>
<form action="https://www.google.com/doodles/">
<input class="button" type="submit" value="I'm so lucky">
</form>
Appreciate any help.
4
Answers
Make the forms inline with CSS
Other option is you can use the form id and target the form and put the button inside the other form.
Forms are
block
elements by default, you’ll need to make these twoinline
for them to be on the same line.Alternatively, wrap them in a
flex
container.You put your form on a
<div></div>
and on your CSS, past you div ondisplay: flex
. I after, I’ve give amargin-left
on the second button to get space between the button.Learn the flexbox, now, it’s really important! 🙂
Have a good day.
You can use flex box to solve your problem