【问题标题】:Google Chrome rendering problem whereas the code is working on IEGoogle Chrome 呈现问题,而代码在 IE 上运行
【发布时间】:2010-12-16 05:20:10
【问题描述】:

它应该看起来像这样 - 在 IE 上工作

但在 Google Chrome 上并没有像上面那样显示:

让我粘贴我一直在使用的代码:

结构:

.header |_ .h-box-style & .h-box-1 |_.ad-title |_.ad-内容

HTML 代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
    <title>OrderBorder.com -- The way you want the deals for Apple mobile phones </title>
    <link href="styles/main.css" type="text/css" rel="stylesheet"/>
    <script src="scripts/jquery-1.4.4.min.js" type="text/javascript" language="javascript"></script>
    <script src="scripts/cufon-yui.js" type="text/javascript" language="javascript"></script>

</head>
<body>

    <div class="main">
        <div class="header">
            <div class="h-box-1 h-box-style">
                <span class="ad-title">Enjoy Group Savings</span>
                <div class="ad-content">
                    Wholesale prices for your Apple gear get lower with larger group size.
                </div>
            </div>
            <div class="h-box-2 h-box-style">
                <span class="ad-title">Earn Points</span>
                <div class="ad-content">
                    Keep earning points with every purchase you and your friends make.
                </div>
            </div>
            <div class="h-box-3 h-box-style">
                <span class="ad-title">Reach Borderline Prices</span>
                <div class="ad-content">
                    Eat my dust group!!! Use your points to bring your own prices to the border.
                </div>
            </div>
        </div>
    </div>
</body>
</html>

CSS代码:

body
{
    margin:0px;
    background-image:url(../images/background.jpg);
}
 div.main
{
    background-image:url(../images/main_background.jpg);
    background-repeat:no-repeat;
    height:950px;
    width:897px;
    margin-right:auto;
    margin-left:auto;
}

div.main div.header
{
    width:893px;
    height:120px;
    margin-top:120px;
    float:left;
}

div.main div.header div.h-box-style
{
    width:100%;
    height:100%;
}

div.main div.header div.h-box-style span.ad-title
{
    color:Black;
    font-family:Arial;
    font-size:20px;
    width:100%;
    background-color:Red;
}

div.main div.header div.h-box-style div.ad-content
{
    color:Gray;
    font-family:Arial;
    font-size:12px;
    width:100%;
    height:40px;
}   

div.main div.header div.h-box-1
{
    float:left;
    width:220px;
    height:80px;
    margin-left:80px;
    margin-top:20px;
}

div.main div.header div.h-box-2
{
    float:left;
    width:220px;
    height:80px;
    margin-left:70px;
    margin-top:20px;
}

div.main div.header div.h-box-3
{
    float:left;
    width:250px;
    height:80px;
    margin-left:30px;
    margin-top:20px;
}

当我使用 Google Chrome 开发者工具检查源代码时,我可以看到 css 应用于 .ad-titlead-content 但这些代码并没有改变任何东西。

所以我已经粘贴了我所做的一切。有人能帮我解释一下为什么谷歌浏览器会这样,并且不会在“.header”下的页面上显示文本。

提前致谢。

【问题讨论】:

    标签: html css internet-explorer google-chrome


    【解决方案1】:

    我正在运行 Chrome v. 8.0.552.224 并且文本显示正确...问题不在您的 html 代码中...

    【讨论】:

    • 我使用的是同一个版本8.0.552.224,但我什么都看不到。
    【解决方案2】:

    我发现了问题。 ad-titlead-content 以某种方式匹配不属于我的应用程序的其他一些内部 css 规则。当我将名称更改为 h-titleh-content 时,它们开始正常工作。

    尤其要小心,当您使用AdBlock 扩展时,因为他们不喜欢ad 字。

    【讨论】:

    • 如果你以某种方式遇到这个问题,这就是你可能需要的答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-08
    • 1970-01-01
    • 2014-03-27
    • 1970-01-01
    • 2017-07-20
    相关资源
    最近更新 更多