Linked Questions

Popular Questions

Position div relative height to parent

Asked by At

I'm trying to get the Log in text to be positioned at 33% height from the parent Card-Header-Background, but instead it looks like the height is being applied to the overall card.

.Account-Details-Card-Background {
  width: 780px;
  height: 600px;
  border-radius: 18px;
  box-shadow: 0 7px 70px 0 rgba(90, 97, 105, 0.1), 0 10px 10px 0 rgba(90, 97, 105, 0.06), 0 4px 8px 0 rgba(90, 97, 105, 0.12), 0 2px 0 0 rgba(90, 97, 105, 0.11);
  background-color: #ffffff;
}

.Card-Header-Background {
  width: 780px;
  height: 69.6px;
  border-radius: 18px;
  box-shadow: 0 1px 0 0 #e0e2e8, 0 -1px 0 0 #e0e2e8;
  background-color: #ffffff;
}

.Label---Log-in {
  width: 61px;
  height: 24px;
  font-family: SFProText;
  font-size: 20px;
  font-weight: 500;
  font-style: normal;
  font-stretch: normal;
  line-height: normal;
  letter-spacing: -0.5px;
  text-align: center;
  color: #3c5071;
}
<div class="Account-Details-Card-Background" style="margin: 17.6vh 22.9vw; position: absolute">
  <div class="Card-Header-Background">
    <div>
      <div class="Label---Log-in text" style="margin: 33% 45%; position: absolute;">
        Log in
      </div>
    </div>
  </div>
</div>

(codepen)

Related Questions