2

我的网站在 Chrome 中的显示与其他浏览器不同。我检查过 IE、Firefox、Safari 和 Chrome。除了 Chrome,一切都很好。

看着 CSS 我不确定问题是什么。

它的 3 个大小相等的盒子彼此相邻。左侧和中间框对齐,但右侧框在 Chrome 中高出 20 像素。

这是盒子的CSS:

#home_boxes {
    margin: 20px 0 0 0;
    clear: both;
    width: 1000px;
    overflow: hidden;
}

#home_boxes p {
    margin-top: 0;
    font-size: 10pt;
}
#home_boxes h2 {
        margin-top: 0;
        margin-bottom: 5px;
        font-size: 14pt;
        font-family: Verdana, Arial, Geneva, sans-serif;
    }

#home_boxes .box_content {
        width: 220px;
        float: right;
        padding: 5px;
    }

#contact_box {
    width: 318px;
    min-height: 150px;
    height: 100%;
    background: url('../images/3box/contact.png') no-repeat #efefef;
    float: left;
    margin-right: 20px;
    border: 1px solid #c9c9c9;
}

#contact_box:hover {
    background: url('../images/3box/contact-hover.png') no-repeat #00529f;
    border: 1px solid #c9c9c9;
    color: #fff;
}

#about_box {
    width: 318px;
    min-height: 150px;
    height: 100%;
    background: url('../images/3box/about.png') no-repeat #efefef;
    float: right;
    margin-right: 20px;
    border: 1px solid #c9c9c9;
}

#about_box:hover {
    background: url('../images/3box/about-hover.png') no-repeat #00529f;
    border: 1px solid #c9c9c9;
    color: #fff;
}

#home_boxes #side_newsletter_box {
    width: 320px;
    background: url('../images/3box/newsletter.png') no-repeat;
    overflow: hidden;
    float: right;
}

#newsletter_box {
    width: 318px;
    min-height: 150px;
    height: 100%;
    background: url('../images/3box/newsletter.png') no-repeat #efefef;
    float: right;
    border: 1px solid #c9c9c9;
}


#newsletter_box:hover {
    background: url('../images/3box/newsletter-hover.png') no-repeat #00529f;
    border: 1px solid #c9c9c9;
    color: #fff;
}

这是HTML:

    <div id = "home_boxes">

        <div id="newsletter_box">
            <div class = "box_content">
                <h2><?=get_content(610)?></h2>
                <p><?=get_content(3234)?></p>
                <form action = <?=$myroot?>"newsletter_process.php" method = "post">
                    <input type = "text" name = "email" class = "news_signup_input" value = <?=get_content(27)?> onClick = "this.value=''" />
                    <input type = "submit" name = "newsletter_submit" value = "" class = "news_signup_submit" />
                </form>
            </div>
        </div>

    <a href = "contact">
    <div id = "contact_box">
        <div class = "box_content">
            <h2><?=get_content(1641)?></h2>
            <p><?=get_content(3257)?></p>
        </div>
    </div>
    </a>

    <a href = "about">
    <div id = "about_box">
        <div class = "box_content">
            <h2><?=get_content(3236)?></h2>
            <p><?=get_content(3749)?></p>
        </div>
    </div>
    </a>
</div>

有人能看出问题吗。由于我不确定问题是什么,我一直在搞乱 CSS 一段时间但无济于事。我没有创建此代码,我是从其他人那里获取的。

4

1 回答 1

2

据我所知,它很简单,在 3 个盒子 div ( , , )clear下方但在( ) div 内放置一个。newsletter_boscontact_boxabout_boxmainhome_boxes

像这样的东西

.clear {
clear: both;
line-height: 0%;
height: 0px;
display: block;
}

这应该可以解决您的问题并正确对齐所有框。

于 2013-03-19T13:50:33.897 回答