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

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

    You can try this code. Follow the code in the CSS section.

    div {
      display: inline-block;
      padding: 2vw;
      background-color: green;
    }
    
    table {
      width: 70vw;
      background-color: white;
    }
    Apple Banana Strawberry
    Apple Banana Strawberry
    Apple Banana Strawberry

提交回复
热议问题