An Interest In:
Web News this Week
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
September 19, 2020 03:44 am GMT
Original Link: https://dev.to/rs9110/1-line-css-to-center-object-i5o
1 line css to center object
Your search for a way to put an object absolutely in the dead center has finally come to an end because I'm going to show you how to do just that with a single line of css code.
We accomplish this by using the place-items
property.
First, make sure to set the display
to grid
. Then, set the place-items
to center
as shown below.
div { display: grid; place-items: center;}
That's it.
Original Link: https://dev.to/rs9110/1-line-css-to-center-object-i5o
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To