0

Assuming I cannot touch the parent element (Body in my example) - what options do I have to position child div both horizontally and vertically within bounds of parent element? If this is not possible with this setup what parent style would allow me to do that?

html,
body {
  width: 100%;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  background: slategray;
  margin: 0px;
  padding: 0px;
}

.child {
  display: flex;
  background: lightsalmon;
  /* Horizontal Alignment **WORKS** */
  align-self: center;
  /* Vertical Alignment **DOES NOT WORK** */
  justify-self: stretch;
  margin: 2px;
}
<div class="child">
  Child_1
</div>
Pawel
  • 891
  • 1
  • 9
  • 31

0 Answers0