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

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

I have a layout similar to:

I would like for the div to only exp

30条回答
  •  -上瘾入骨i
    2020-11-21 08:10

    The answer for your question lays in the future my friend ...

    namely "intrinsic" is coming with the latest CSS3 update

    width: intrinsic;
    

    unfortunately IE is behind with it so it doesn't support it yet

    More about it: CSS Intrinsic & Extrinsic Sizing Module Level 3 and Can I Use?: Intrinsic & Extrinsic Sizing.

    For now you have to be satisfied with or

    set to

    display: inline-block;
    

提交回复
热议问题