Min-width in MSIE 6

前端 未结 11 1488
一生所求
一生所求 2020-12-16 05:35

What is the definitive way to mimic the CSS property min-width in Internet Explorer 6? Is it better not to try?

11条回答
  •  盖世英雄少女心
    2020-12-16 06:30

    The shim example is fine for forcing the browser to show a horizontal scroll bar when the container gets to a certain size but you'll notice that the content in the container will still be resized as the window gets smaller. I imagine that this is not the overall goal when trying to achieve minimum width in IE 6.

    Incomplete min-width technique http://www.mediafire.com/imgbnc.php/260264acec99b5aba3e77c1c4cdc54e94g.jpg

    Furthermore, the use of expressions and other crazy CSS hacks just isn't good practice. They are unsafe and unclean. This article explains the caveats of CSS hacks and why they should be avoided altogether.

    I personally consider scaryjeff's post to be the best advice for achieving true min-width in IE6 and as an experienced CSS layout developer I've yet to find a better solution that is as applicable to problems of this kind.

    This article on CSS Play, by Stu Nicholls, shows the different methods for achieving min-width in IE, in all modes (Quirks, etc) and even for IE/Mac.

    I've provided an answer to a similar question that details the use of this technique to correctly achieve min-width. It can be viewed here:

    CSS: Two 50% fluid columns not respecting min width

    The technique is simple, valid CSS that can be used in almost any situation. Applied to the shim example above it results in what I consider to be correct min-width functionality.

    Correct min-width technique http://www.mediafire.com/imgbnc.php/a67b2820bfbd6a5b588bea23c4c0462f4g.jpg

提交回复
热议问题