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

前端 未结 30 4212
青春惊慌失措
青春惊慌失措 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:05

    Try to use width: max-content property to adjust the width of the div by it's content size.

    Try this example,

    
    
    
    
    
    
    
    
    This div element has width 500px;

    Width by content size

提交回复
热议问题