0

Why isn't it centered?

So, I have made an HTML code This is just a div that moves using css animation But can anyone tell me why isn't it centered Note: I want it in the center of the screen https://sololearn.com/compiler-playground/WmstxUgO2vM2/?ref=app

12th Jun 2024, 10:22 AM
Aayush
Aayush - avatar
3 odpowiedzi
+ 4
The container div with the center class only takes as much size as necessary to contain the box. https://sololearn.com/compiler-playground/WMFRrhzTQ2JV/?ref=app You could adjust the size of the container div.
12th Jun 2024, 10:35 AM
Lisa
Lisa - avatar
+ 1
In the HTML file, the <div class="box"></div> Just add <center> <div class="box"><center></div> it will center the box
12th Jun 2024, 4:50 PM
Anna Bojczuk
Anna Bojczuk - avatar
+ 1
Add height:100vh; to "center" class
14th Jun 2024, 8:44 AM
Uchiha Itachi
Uchiha Itachi - avatar