Div position | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Div position

how to make position of div or section in center of page?

20th Oct 2018, 3:23 PM
Risky Ashari
Risky Ashari - avatar
4 Answers
+ 11
Both this methods dont require any calculations and are responsive. Method 1: With Flexbox. https://youtu.be/7BAG-h2f9kA Method 2:With Margin:auto. https://youtu.be/sDUpTaCBUHQ
20th Oct 2018, 5:56 PM
Mitali
Mitali - avatar
+ 4
HTML: <div></div> CSS: div { top:0; bottom:0; left:0; right:0; margin:auto; position: absolute; }
28th Nov 2018, 10:37 AM
DIPTIRANI SAHU
+ 2
hei bro its helped me thanks you so much :)
20th Oct 2018, 3:28 PM
Risky Ashari
Risky Ashari - avatar
+ 1
Use <center> tag To Make that element perfectly centerd
29th Nov 2018, 2:38 PM
Kelvin Paul
Kelvin Paul - avatar