How to center an element with CSS

#1

.center {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}

#2

.center{display: flex;
align-items: center;
justify-content: center;}

#3

.center{ display:grid;place-items:center;}

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments

Start typing and press Enter to search