CSS min-width in IE6, 7, and 8

前端 未结 8 2238
执笔经年
执笔经年 2020-12-09 11:09

I found many answers to this question on Google, but none of them seem to work for all browsers.

I am looking for a CSS-only way to get min-width working on Firefox,

8条回答
  •  隐瞒了意图╮
    2020-12-09 11:31

    I was having a similar issue, I needed a site to be 95% unless it was less than 980px.

    Nothing here worked, and in desperation I reached out to Bill Burlington's expression answer. The one mentioned above didn't work for me, but if I used a more robust expression it did!

    width: expression ( document.body.clientWidth < 980 ? "980px" : "95%" );
    

    This basically says if the width is less than 980px, set the width to 980px. If it's wider, set the width to 95%.

提交回复
热议问题