Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

center div horizontally and vertically

.parent {
  position: relative;
}
.child {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
Source by codepen.io #
 
PREVIOUS NEXT
Tagged: #center #div #horizontally #vertically
ADD COMMENT
Topic
Name
3+2 =