How to make text input box to occupy all the remaining width within parent block?

后端 未结 6 1911
星月不相逢
星月不相逢 2020-12-04 13:15

How do achieve the following:

┌────────────────────parent────────────────────┐
│ label [text-box                   ] [button] │
│ paragraph                           


        
6条回答
  •  情书的邮戳
    2020-12-04 13:52

    Don't forget, you can use calc(). Let's assume total of width used by label and button is 100px (including margin), then the width is:

    .text-box {    
      width: calc(100% - 100px);
    }
    

    If you think it doesn't support a lot of browser, well you are wrong indeed. It supports a lot now. Time has changed

提交回复
热议问题