This content originally appeared on DEV Community and was authored by Robson Muniz
3 Ways to Center Content Horizontally and Vertically in CSS✨
Classic Option
.classic{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
CSS Grid Way
.grid{
display: grid;
place-items: center;
}
Flexbox Way
.flexbox{
display: flex;
align-items: center;
justify-content: center;
}
🛴 Follow me on:
https://bit.ly/3oBQbc0
This content originally appeared on DEV Community and was authored by Robson Muniz

Robson Muniz | Sciencx (2022-02-12T13:05:22+00:00) 🔥3 Ways to Center Content Horizontally and Vertically in CSS✨. Retrieved from https://www.scien.cx/2022/02/12/%f0%9f%94%a53-ways-to-center-content-horizontally-and-vertically-in-css%e2%9c%a8/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.