How does css adapt when the width is not clear?

clipboard.png

what do I need to do to adapt the div width of the middle input? Is there any good way to do this without knowing the total width

  <header class="header-div">
      <div class="header-top">
        <div class="header-img">
          <img src="../../static/position.png" alt="" style="margin-top: -5px">
        </div>
        <span></span>
        <div>
          <div class="header-img">
            <img src="../../static/searrch.png" alt="">
          </div>
          <input type="text" placeholder="">
        </div>
        <div class="header-img">
          <img src="../../static/email.png" alt="" >
        </div>
      </div>
    </header>

I set the width of both sides as rem, so I don"t know exactly how much it is

.
/*** rem   scss ***/
@function px2rem($px, $base-font-size: 75px) {
    @return ($px / $base-font-size) * 1rem;
}
/*** rem end ***/

//
.div {
        width: px2rem(40px);
        height: px2rem(40px);

 }

I can"t always set the width for the middle div

width: calc(100% - px2rem(XXX));

.
ask everyone to take a look at it for me

Css
Mar.10,2021

this is actually similar to the Holy Grail layout.
if you don't consider compatibility, you can use flex to implement it. You can use float

under Baidu or very simple
to consider compatibility.

for example, if you have two columns, the left is fixed at 200px and the right is full.
then let the right element-margin equal to the left element, so that the element can go up, and
and padding-left is set to the width of the left element, so that it does not take up the space of the left element

.
  

calc learn about

Menu