Answers for "centering a div in css"

CSS
89

center a div in css

.container {
  display: flex;
  justify-content: center;
  align-items: center;
}
Posted by: Guest on September-09-2020
9

center div horizontally and vertically

.parent {
  position: relative;
}
.child {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
Posted by: Guest on June-22-2020
0

how to center a div

.container {
  ...
  display: flex;
  justify-content: center;
}
Posted by: Guest on February-02-2021

Browse Popular Code Answers by Language