2 divs aligned side by side, how to make right div fill width 100%?

前端 未结 8 1060
遥遥无期
遥遥无期 2021-01-31 08:17

I\'m wondering what the best way to go about doing this is...

I have 3 divs:

  • a div#container with width=100%; tha

8条回答
  •  温柔的废话
    2021-01-31 08:29

    This can be accomplished using Flex-Box, which has been introduced with CSS3 and according to Can I use is cross-browser.

    .container { 
      display: flex; 
    }
    
    .left {
      width: 100px; /* or leave it undefined */
    }
    
    .right { 
      flex-grow: 1;
    }
    
    /* some styling */
    .container {height: 90vh}
    .left {background: gray}
    .right {background: red}
    100px
    Rest

提交回复
热议问题