How can divs (and other elements) be aligned horizontally, rather than vertically, across a webpage? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can divs (and other elements) be aligned horizontally, rather than vertically, across a webpage?

26th Jun 2018, 1:00 AM
Nick
Nick - avatar
2 Answers
+ 5
using CSS , specify your elements' widths and use the float property like this , float:left; or float:right; this pushes your div left or right of the element before it .
26th Jun 2018, 1:04 AM
Nsamba Abubaker
Nsamba Abubaker - avatar
+ 2
Use flexbox display:flex you could align it horizontally or vertically by setting flex-direction: row/column
26th Jun 2018, 6:47 AM
Calviղ
Calviղ - avatar