Answers for "center div html"

85

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
14

css align items vertical center

.parent {
  display: flex;
  justify-content: center;
  align-items: center;
}
Posted by: Guest on October-31-2020
0

centrer une div

.center-div {
     margin: 0 auto;
     width: 100px; 
}
Posted by: Guest on May-19-2020
20

how to center text in css

.class {
	text-align: center;
}
Posted by: Guest on February-15-2020
0

center div html

//Center DIV HTML5

<body>
    <div style="width:800px; margin:0 auto;">
        centered content
    </div>
</body>
Posted by: Guest on July-30-2021

Browse Popular Code Answers by Language