Answers for "center a div in css"

CSS
86

center a div in css

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

center a div css

.center {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
Posted by: Guest on March-31-2021
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
23

center with css

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

how to center an element in css

.element {
  position: absoloute;
  margin: auto;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}
Posted by: Guest on August-04-2021
0

center a div

.container{
	margin: 0 auto;
    display: flex;
    align-items: center;
}
Posted by: Guest on August-03-2021

Browse Popular Code Answers by Language