+ 2

How can i center elements vertically?

I want to center the elements in this project https://code.sololearn.com/Wjih72K8EuOX/?ref=app

22nd Apr 2023, 12:04 AM
Irbaine Mohamed Amine
Irbaine Mohamed Amine - avatar
4 RĂ©ponses
+ 8
SoloProg You can use center tag also before the body tag and you can use css also.
22nd Apr 2023, 4:45 AM
Sakshi [Offline 🙃]
Sakshi [Offline 🙃] - avatar
+ 6
/*Maybe you like this:*/ body { height: 100vh; padding: 25px; background-color: white; color: black; font-size: 25px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
22nd Apr 2023, 2:32 PM
JaScript
JaScript - avatar
+ 3
/* to center the elements */ body { margin: 25%; text-align: center; vertical-align: middle; }
22nd Apr 2023, 12:34 AM
SoloProg
SoloProg - avatar
+ 2
body { padding: 25px; background-color: white; color: black; font-size: 25px; position: absolute; } .dark-mode { background-color: black; color: white; } button{ position: relative ; padding: 15px; font-size: 20px; font-weight:bold; left: 100px; }
22nd Apr 2023, 6:16 AM
Vaibhav
Vaibhav - avatar