Setting width:auto leads to width:100%

后端 未结 3 1864
情深已故
情深已故 2021-01-02 04:24

I am a little bit tired right now (out of coffee), so I am unable to figure this out.

When I set p.style.width = auto (the blue one), why is its w

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-02 04:54

    The others are right, width: auto sets the width to fill all available space.

    One solution would be to use display: inline-block, which should do what you want. For compatibility with IE6 it's best to apply that to an inline element like . And add display: -moz-inline-box for Firefox 2 and earlier.

提交回复
热议问题