Created
December 6, 2023 07:11
-
-
Save hariscs/29eb7702403579c5d4f006c77fe8c3e3 to your computer and use it in GitHub Desktop.
Center an absolutely positioned element in a div
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.center { | |
position: absolute; | |
left: 50%; | |
top: 50%; | |
transform: translate(-50%,-50%); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment