简体   繁体   English

与IE7的兼容性问题?

[英]Compatibility issues with IE7?

I'm working on a site and having compatibility issues with IE7 (not working) vs IE8/Firefox (working). 我正在一个网站上工作,并且与IE7(不工作)和IE8 / Firefox(工作)存在兼容性问题。 Can someone take a look at the following CSS and Screenshots and tell me why my site is broken in IE7 and what I can do to fix it? 有人可以看看下面的CSS和屏幕截图,并告诉我为什么我的网站在IE7中被破坏,我可以做些什么来解决它?

The site in question is live here: CollectionTree 该网站现场直播: CollectionTree

and my css part for that view is 而我对这个观点的css部分是

#landingMainContainer
{
    padding-left:10px;
    margin: 0 auto; 
    text-align: center; 
    min-height: 400px; 
    width: 960px;
}
.landingTop
{
    width:100%;
    min-height:400px;
    background:url('/Content/Images/BG_gray1_v2.png') no-repeat;
}
.landingTopInfo
{
    padding-top:10px;
    text-align:left;
    width:50%;
    padding-left:15px;
}
.landingTopInfoText
{
    padding-left:20px;
    padding-top:20px;
    float:left;
    color:#000000;
    font-size:20px;
}
.landingTopInfoTextTitle
{
    font-size:26px;
    text-align:left;
    padding-left:40px;
    padding-top:10px;
    clear:left;
    color:#209202;
}
.landingTopInfoTextContents
{
    font-size:12px;
    padding-left:40px;
    padding-top:10px;
    clear:left;
    color:#000000;
}
.landingTopInfoSignUpSection
{
    clear:left;
    float:left;
    padding-left:40px;
    padding-top:30px;
}
.landingTopInfoSignUpSectionText
{
    padding-left:10px;
    padding-top:10px;
    float:left;
    font-weight:normal;
}
.landingTopInfoImage
{
    float:right;
    background:url('/Content/Images/Dashboard_mockup.png') no-repeat;
    width:40%;
    height:290px;
}
.landingBottomInfo
{
    width:100%;
    float:left;
    padding-left:20px;
    color:#000000;
}
.landingBottomInfoSection
{
    float:left;
    width:30%;
    text-align:left;
    font-size:10px;
    font-weight:normal;
    padding-left:20px;
}
.landingBottomInfoSectionText
{
    width:66%;
    float:right;
    text-align:left;
}
.landingBottomInfoSectionTextFirstLine
{
    font-size:11px;
    font-weight:bold;
}
.landingBottom
{
    width:100%;
    min-height:150px;
}
.landingBottomLeftSection
{
    background:url('/Content/Images/BG_gray2_v2.png') no-repeat;
    width:60%;
    min-height:140px;
    float:left;
}
.landingBottomLeftSectionTitle
{
    font-weight:normal;
    font-size:19px;
    color:#FFFFFF;
}
.landingBottomLeftSectionImage
{
    float:left;
    padding-left:40px;
    padding-top:10px;
}
.landingBottomLeftSectionText
{
    padding-right:100px;
    padding-top:10px;
    float:right;
}
.landingBottomLeftSectionTextTitle
{
    font-weight:bold;
    color:#000000;
    font-size:14px;
}
.landingBottomLeftSectionTextSentence
{
    text-align:left;
    color:#000000;
    padding-top:10px;
    padding-left:15px;
    font-weight:normal;
    font-size:10px;    
}
.landingBottomRightSection
{
    padding-top:7px;
    width:35%;
    min-height:140px;
    float:right;
}
.landingBottomRightSectionTitle
{
    text-align:left;
    color:#209202;
    font-weight:bold;
}
.landingBottomRightSectionText
{
    width:70%;
    color:#000000;
    font-size:10px;
    font-weight:normal;
    padding-top:15px;
    text-align:left;
    float:left;
}
.landingBottomRightSectionTextLink
{
    text-align:left;
    padding-top:20px;
}
a.landingBottomRightSectionTextLink:link { color: #3399FF; text-decoration: none; font-weight:bold; font-size:11px; }
a.landingBottomRightSectionTextLink:active { color: #3399FF; text-decoration: none; font-weight:bold; font-size:11px; }
a.landingBottomRightSectionTextLink:visited { color: #3399FF; text-decoration: none; font-weight:bold; font-size:11px; }
a.landingBottomRightSectionTextLink:hover { color: #3399FF; text-decoration: underline; font-weight:bold; font-size:11px; }
.landingBottomRightSectionImage
{
    width:30%;
    float:right;
}

Here is a screenshot of the website displaying correctly in IE8: 以下是在IE8中正确显示的网站截图: 替代文字
Full Image 完整图像

Here is the website looking messed up in IE7: 这是在IE7中搞砸的网站: 替代文字
Full Image 完整图像

What do I need to change with my CSS to make my page look "ok" in IE7 as well as IE8? 我需要用CSS改变什么才能使我的页面在IE7以及IE8中看起来“正常”?

Start with adding a float:left to .landingTopInfo: 首先添加一个float:left to .landingTopInfo:

.landingTopInfo{ 
    float: left;
    padding-top:10px;
    text-align:left;
    width:50%;
    padding-left:15px;}

That'll get you in the ballpark. 那会让你进入球场。

For the .landingBottomInfo area, I'd foat the image and text items (.landingBottomInfoSectionText) left and set the left padding to fit. 对于.landingBottomInfo区域,我将向左移动图像和文本项(.​​landingBottomInfoSectionText)并将左边距设置为适合。

I think it has to do with your use of percentage-based widths on a floated element. 我认为这与你在浮动元素上使用基于百分比的宽度有关。

IIRC, IE7 rounds percentage-to-pixel calculations differently, which could result in the combined width being > 100%. IIRC,IE7以不同的方式对百分比到像素的计算进行舍入,这可能导致组合宽度> 100%。

remove the align center (aka align left on the landingMainContainter ) and then floating the .landingTopInfo left. 删除对齐中心(也就是在landingMainContainter上左对齐)然后浮动.landingTopInfo左边。

#landingMainContainer
{
    padding-left:10px;
    margin: 0 auto; 
    **text-align: left;** 
    min-height: 400px; 
    width: 960px;
}

.landingTopInfo
{
    padding-top:10px;
    text-align:left;
    width:50%;
    padding-left:15px;
    **float:left;**
}

Give landingTopInfo a padding-top: 10px; landingTopInfo一个padding-top: 10px;

Give landingTopInfoText a float: left; landingTopInfoText一个float: left; and change its padding-top to 10px 并将其padding-top更改为10px

Give your "monitor," "compare," and "view" images each a float: left; 给你的“监视器”,“比较”和“查看”图像每个float: left;

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

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