How to make table cell shrink according to the content?

前端 未结 4 641
野性不改
野性不改 2021-02-02 05:25

How can I make the table with 2 columns (cells) look like this:

  • First cell is shrink according to the content
  • The other cell fits the rest of the table (w
4条回答
  •  你的背包
    2021-02-02 06:19

    You can set the width of the second cell to 100%

    HTML:

    foo bar

    CSS:

    table { width: 500px; }
    .grow { width: 100%; }​
    

    Check this fiddle out.

提交回复
热议问题