How can I make a div not larger than its contents?

前端 未结 30 3664
青春惊慌失措
青春惊慌失措 2020-11-21 07:35

I have a layout similar to:

I would like for the div to only exp

30条回答
  •  逝去的感伤
    2020-11-21 07:52

    Tampering around with Firebug I found the property value -moz-fit-content which exactly does what the OP wanted and could be used as follow:

    width: -moz-fit-content;
    

    Although it only works on Firefox, I couldn't find any equivalent for other browsers such as Chrome.

提交回复
热议问题