0

I'm trying to make a fixed header that fit it parent container.

.body {
  display: flex;
  width: 100wp;
  height: 700px;
  border: 1px red solid;
 padding-left: 0px;
  padding-right: 80px;
}

.sticky {
  border: 1px blue solid;
  position: fixed;
  width: 100%;
  height: 30px;
}
<div class="body">
  <div class="sticky">
  
  </div>
</div>

It going out the container. So i tried inherit property :

.body {
  display: flex;
  width: 100wp;
  height: 700px;
  border: 1px red solid;
 padding-left: 0px;
  padding-right: 80px;
}

.sticky {
  border: 1px blue solid;
  position: fixed;
  width: inherit;
  height: 30px;
}
<div class="body">
  <div class="sticky">
  
  </div>
</div>

And it doesn't fit too...

Is inherit property can't works with a percentage parent width ? If yes, how to manage that ?

Toto NaBendo
  • 290
  • 3
  • 26

0 Answers0