How to align 2 block elements side by side? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to align 2 block elements side by side?

I want to put an button next to an input form field. How can i do this without using bootstrap grid structure?

1st Mar 2017, 12:13 PM
Mridul Mishra
Mridul Mishra - avatar
5 Answers
+ 4
there is a bootstrap inline form that should quickly do the trick
1st Mar 2017, 5:07 PM
seamiki
seamiki - avatar
+ 2
AFAIK buttons and input tags are all html inline elements. So you don't need bootstrap to put them side-by-side. Check below either one works: <label for="email">Email: </label> <input type="text" name="email" value="enter email"> <input type='"submit" name="submit" value="Send"> <hr> <label for="email">Email: </label> <input type="text" name="email" value="enter email"> <button type='"submit>Send</button>
1st Mar 2017, 12:30 PM
Benneth Yankey
Benneth Yankey - avatar
+ 1
put them inside separate div's with class names that align them 50% next to one another. e.g. <div style="display: inline-block">1</div> <div style="display: inline-block">2</div> or simply add float: left; to both.
1st Mar 2017, 12:24 PM
Andre van Rensburg
Andre van Rensburg - avatar
+ 1
use left, right style property to place it properly
1st Mar 2017, 12:24 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
0
I guess you are looking for: float property
1st Mar 2017, 5:17 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar