简体   繁体   English

IE7和IE8之间的兼容性问题

[英]Compatibility issue between IE7 and IE8

I have a CSS which will display the content only with vertical scroll bar and not the Horizontal scroll bar. 我有一个CSS,它将仅使用垂直滚动条而不显示水平滚动条显示内容。

My CSS is, 我的CSS是

div.rightSide {
display: inline;
float: right;
height: 234px;
margin: 5px 0;
overflow-y: auto;
position: relative;
vertical-align: middle;
visibility: inherit;
width: 300px;
z-index: 6;
}

It works as expected in IE8 and Mozilla 3.6, but when I test the same in IE7, vertical scroll bar is also getting displayed. 它可以在IE8和Mozilla 3.6中按预期工作,但是当我在IE7中测试相同功能时,也会显示垂直滚动条。 So what should i want to do in order to overcome this issue? 那么我要怎么做才能克服这个问题?

EDIT 编辑

Adding my HTML code. 添加我的HTML代码。

<body>
    <div>
        <div id="contentColumn">
            <div class="overviewPage">
                <div class="instructionContent" id="sample_id">
                    <div class="overviewBackground" style="z-index: 3;">
                        <p class="sidebar_body">
                            <img align="center" border="0" height="244"
                                src="../images/product/sample.jpg" width="752" />
                        </p>
                    </div>
                    <div class="rightSide">
                        <div class="unitOverview">
                            <p class="body">
                                <span class="bold">Unit 1 Overview</span>
                            </p>
                            <div class="sectionContents">
                                <div class="subhead_pri"> 
                                <!-- My title goes here -->
                                </div>
                                <div class="sectionBody" style="overflow:hidden;width:100%">
                                    <p class="body"> 
                                    <!-- My content Goes here -->
                                    </p>
                                </div>
                            </div>
                        </div>
                        <div class="vendor">ID: vendor1</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

Thanks, Jeya 谢谢Jeya

Add overflow-x: hidden; 添加overflow-x: hidden; to your css as well. 以及您的CSS。

By default IE7 treats your container as if it had overflow: auto . 默认情况下,IE7将您的容器视为已overflow: auto You need to tell it otherwise. 否则,您需要告诉它。 try adding overflow: hidden before overflow-y: auto , helped in my case. 尝试添加overflow: hidden overflow-y: auto 之前 overflow: hidden overflow-y: auto ,对我来说很有帮助。

Experiment with your content. 试用您的内容。 overflow-y:auto means 'only show a vertical scrollbar if you have to.' overflow-y:auto表示“仅在必要时显示垂直滚动条”。 Apparently IE7 thinks your content is tall enough that it needs the scrollbar. 显然IE7认为您的内容足够高,因此需要滚动条。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM