This one line CSS can center object easily : Putting end to your Google search
It's hard to center thing in CSS. Most of the newbie web dev students face problem and often search every time when on any project. Here is the last and final solution to it. That is centering the object with just one line of CSS code.
The place-items
property.
->The place-items
property in CSS is shorthand for the align-items and
justify-items
properties, combining them into a single declaration. These properties have gained use with the introduction of Flexbox and Grid layouts
First, make sure to set the display
property to grid
and then, set the place-items
property to center
.
div {
display: grid;
place-items: center;
}
Ta Da DONE✨🎉🎉🎊 !!!
Thanks For Reading. I mostly do my project using this only. I hope you will find this helpful as i did. Sorry if it doesn't work with you.(it will work chill ✨🎉)
Comments
Post a Comment