Only let certain inner divs control outer div's width

后端 未结 1 1500
失恋的感觉
失恋的感觉 2021-01-23 02:24

I have the follow html structure:

&l
相关标签:
1条回答
  • 2021-01-23 03:17

    Make the container display:inline-block; with overflow:auto; so that it automatically stretches to fit the content. Give Block #2 and Block #3 overflow:auto; too so that they stretch to fit their content.

    Unfortunately, you need to use JavaScript to get the width to be the width of the image. See my example below, where I fix it with jQuery.

    See: http://jsfiddle.net/TFLMX/2

    0 讨论(0)
提交回复
热议问题