【问题标题】:div overlapping footer despite of style="clear:both"?div 重叠页脚尽管 style="clear:both"?
【发布时间】:2012-09-13 06:43:03
【问题描述】:

我正在为 joomla 2.5.6 编写自己的模板。我不确定这个问题是与 Joomla 相关还是与 CSS 相关。

模板很简单,左边是侧边栏,右边是内容,还有一个页脚。现在当内容很短并且侧边栏上有几个模块时,模块会与页脚重叠。

看起来像这样:

http://imageshack.us/photo/my-images/269/screenshotmdph.jpg/

index.php 中的 html 如下所示:

<body>
<div class="container_6">
    <div class="grid_6 header">
        <a href="<?php echo $this->baseurl ?>" title=""><img src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/assets/images/logo.png" alt="home" id="logo"/></a>
        <jdoc:include type="modules" name="menu" />
    </div>
</div>
<div class="container_6">
    <div class="grid_6 head_logo">
        <jdoc:include type="modules" name="header_logo" />
        <div class="left_menu">
            <div class="left_menu_content">
                <jdoc:include type="modules" name="left_menu" style="xhtml" />
            </div>
        </div>
        <div class="right_module">
            <jdoc:include type="modules" name="right" />
        </div>          
    </div>
</div>
<div class="container_6">
    <div class="grid_6">
        <div class="content">
            <div class="content_holder">
                <!-- beginn content -->
                <div class="container_6">
                    <div class="content_component">
                        <jdoc:include type="modules" name="breadcrumb" />
                        <jdoc:include type="component" />
                    </div>
                </div>
            </div>          
        </div>
    </div>
</div>
<div class="clear"></div>
<div class="container_6">
    <div class="grid_6">
        <div class="footer">
        </div>
    </div>
</div>

我使用的是960-grid系统,上面有明确的类,但其他类在这里定义:

    .header {
 background: url('../images/top.png') no-repeat;
 height:93px;
 width:100%;
}

.head_logo {
    background: url('../images/shadow.png') repeat-y;
    padding-right:10px;
    padding-left:12px;
    z-index:1;
    position:absolute;
}
.left_menu {
    background: url('../images/menuBg.png') no-repeat;
    width:284px;
    min-height:611px;
    top:300px;
    z-index:2;
    position:absolute;
}
.right_module {
    width:180px;
    height:40px;
    padding:10px;
    background-color:#e9e9e9;
    top:300px;
    left:730px;
    z-index:3;
    position:absolute;
}

.content {
    background: url('../images/shadow.png') repeat-y;
    min-height:500px;

}
.content_holder {
    background-color:#e9e9e9;
    width:960px;
    margin-left: auto;
    margin-right: auto;
    min-height:500px;
}

.content_component {
    width:666px;
    padding:5px 5px 5px 284px;
    margin:0 5px;
}

#logo {
    margin:15px 0 0 25px;
    float:left;
}

.footer{
    background: url('../images/bottom.png') no-repeat;
    width:100%;
    height:92px;
}

我对此感到迷茫,因为由于页脚上方的清除类,它应该可以工作,但它没有。不幸的是,我没有在线示例,它都是本地的

有人知道我如何找到错误吗?非常感谢

附加信息:

对不起,我忘记了,

<div class="clear"></div>

在grid.css中定义,如下所示:

.clear {
  clear: both;
  display: block;
  overflow: hidden;
  visibility: hidden;
  width: 0;
  height: 0;
}

我也编辑了问题标题,抱歉错了

加法!!

我想添加问题的屏幕截图。请看这里:

http://www.bilder-hochladen.net/files/jegt-i-6f49-jpg.html

你看,.left-menu 是绝对定位的,并且从 .head-logo 类开始。 .left-menu 不应进入紫色页脚。

如何告诉内容 div 与左侧菜单的高度相等?

【问题讨论】:

    标签: css templates html joomla


    【解决方案1】:

    使用Clear:both 代替clear:all,这不是MHO 中的样式定义。

    【讨论】:

    • 谢谢,这是我的错误,我没有使用 clear:all,我使用的是 960-grid 系统定义的 clear 类。我在问题中更改了它
    【解决方案2】:

    从表面上看,您可能将“清除” div 放置在错误的位置,但很难说,没有看到附加了所有 css 的实际页面,包括网格的。也许您可以实际生成页面,保存到本地磁盘并使其在线?

    【讨论】:

    • 谢谢!我想我知道问题出在哪里。现在构建了 css,左侧菜单在带有标题图像的 div 中生成,因为它必须与标题图像重叠。内容是在下面的div中创建的,所以没有办法告诉parent-div清除浮动,因为左侧菜单和内容有不同的parend div......所以我的问题是网站的基本设置。但我无法更改父 div,因为我需要菜单与上父级重叠......嗯
    • 如果有人对此有想法我会很高兴...我尝试添加另一个 div 作为可以清除的容器,从而告诉页脚从哪里开始,但它没有帮助.. .
    • 我在帖子中添加了一个屏幕截图来解释问题。如果有人能帮忙,我会很高兴
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-07
    相关资源
    最近更新 更多