How to make an inline-block element fill the remainder of the line?

前端 未结 7 1574
抹茶落季
抹茶落季 2020-11-28 01:11

Is such a thing possible using CSS and two inline-block (or whatever) DIV tags instead of using a table?

The table version is this (borders added so you can see it):

相关标签:
7条回答
  • 2020-11-28 01:56

    A modern solution using flexbox:

    .container {
        display: flex;
    }
    .container > div {
        border: 1px solid black;
        height: 10px;
    }
    
    .left {
       width: 100px;
    }
    
    .right {
        width: 100%;
        background-color:#ffffd;
    }
    <div class="container">
      <div class="left"></div>
      <div class="right"></div>
    </div>

    http://jsfiddle.net/m5Xz2/100/

    0 讨论(0)
提交回复
热议问题