Answers for "center flex container on page"

7

css flex center

display: flex;
align-items: center;
justify-content: center;
Posted by: Guest on April-23-2020
0

move text to center of page flexbox

// Assuming a horizontally centered row of items for the parent but it doesn't have to be
.parent {
  align-items: center;
  display: flex;
  justify-content: center;
}

.child {
  display: flex;
  align-items: center;
}
Posted by: Guest on April-15-2021
0

center div using flex

<div class="container">
  <div class="item"></div>
</div>

div.container {
  background: gray;
  width: 80px;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
}

div.item {
  background: silver;
  width: 30px;
  height: 30px;
}
Posted by: Guest on October-03-2021

Code answers related to "center flex container on page"

Browse Popular Code Answers by Language