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

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

I have a layout similar to:

I would like for the div to only exp

30条回答
  •  心在旅途
    2020-11-21 08:11

    Not knowing in what context this will appear, but I believe the CSS-style property float either left or right will have this effect. On the other hand, it'll have other side effects as well, such as allowing text to float around it.

    Please correct me if I'm wrong though, I'm not 100% sure, and currently can't test it myself.

提交回复
热议问题