【问题标题】:Joomla Footer Middle Of Page With 100% Height DIVs具有 100% 高度 DIV 的页面中间的 Joomla 页脚
【发布时间】:2017-06-30 10:28:37
【问题描述】:

我必须使用 Joomla 框架并创建 100% 高度的 DIV。我已经成功地做到了。但是,当尝试添加页脚时,它会飞向屏幕顶部并覆盖所有内容。

通过 DOM 进一步检查后,我发现了一些有趣的东西:框架类 .item-page 和 div itemprop="articleBody" 自动添加的所有部分在 DOM 树中的部分下都有,就像它们应该包含的一样但是它们只包含高度方面的第一个 DIV。所以看起来我的页脚正试图适应第一个 DIV。

作为记录,我已成功加载 Bootstrap 3。

非常感谢您的帮助。

HTML - INDEX.PHP

<div class="container-fluid">
  <nav class="navbar" role="navigation">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" 
                data-toggle="collapse" 
                data-target=".navbar-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>
        <div class="collapse navbar-collapse">
          <jdoc:include type="modules" name="nav" style="html5" />
        </div>
    </nav>


    <jdoc:include type="message" />
    <jdoc:include type="component" />

<!--END CONTAINER-->
</div>
<footer>
    <div class="container">
        <div class="row footer-container footer-row">
            <div class="col-sm-3">
                <div class="footer-logo">Logo</div>
            </div>

            <div class="col-sm-9">
                <p class="footer-about">
                    About
                </p>
                <p class="footer-text">
                    Footer content here
                </p>
            </div>

            <div class="col-sm-3">
                <p class="footer-about">
                    Contact Info
                </p>
            </div>
        </div>
    </div>
    </footer>

HTML - 受影响页面的代码编辑器

<div class="container-fluid">
    <div id="landing-bkg">
        <div class="row">
            <div class ="col-sm-7 col-xs-12">
                <h1>Headline</h1>
                <h3>Subhead</h3>
                <div class="btn">
                    <p>Button</p>
                </div>
            </div>
        <!-- END COL -->
        </div>
        <!-- END ROW -->
    </div>
    <!-- END LANDING BKG-->

    <div id="another2">
        <div class="row">
            <div class="col-sm-12">
                <h2 class="center">Headline</h2>
                <h3 class="center">Subhead</h3>
                <div class="btn btn-center">
                    <p class="center">Button</p>
                </div>
            </div>
        <!-- END COL -->
        </div>
        <!-- END ROW -->
    </div>
    <!-- END ANOTHER2-->

    <div id="another3-bkg">
        <div class="row">
            <div class="col-sm-12">
        <div class="row">
                    <div class ="col-md-7 col-sm-12 col-xs-12">
                        <h2>Headline</h2>
                        <h3> Subhead</h3>
                        <div class="btn">
                            <p>Button</p>
                        </div>
                    </div>
                    <!-- END NESTED COLUMN -->
                </div>
                <!-- END NESTED ROW -->
            </div>
        <!-- END COL -->
        </div>
        <!-- END ROW -->
    </div>
    <!-- END ANOTHER3 BKG-->

    <div id="another4">
        <div class="row">
            <div class="col-sm-12">
                <h2 class="center">Subhead</h2>
                <form>
                    <input type="email" placeholder="Input Field" class="center-block">
                </form>
                <div class="btn btn-center">
                    <p class="center">Button</p>
                </div>
            </div>
        <!-- END COL -->
        </div>
        <!-- END ROW -->
    </div>
    <!-- ANOTHER 4 -->
</div>
<!-- END CONTAINER -->

CSS

/****HTML & BODY ****/

html,
body{
    width:100%;
    height:100%; //Makes my DIVs 100% height, works great
    margin:0;
    padding:0;
}

/****CONTAINER ****/
.container-fluid{
  100%
}

/**** JOOMLA CLASSES I OVER RIDE TO GET THE DIVS AT 100% DOESN'T WORK WITHOUT IT ****/
.item-page{
  height:100%;
}
div[itemprop="articleBody"]{
 height:100% !important;
}


/**** FOOTER ****/

.footer-container{
    background-color:#565A5C;
    width:100%;
    padding-top:50px;
    padding-bottom:25px;
}

footer{
    position:relative;
}

.footer-row{
    width:100% !important;
    margin:0 !important;
}

【问题讨论】:

    标签: html css joomla


    【解决方案1】:

    不是 100% 确定你想要什么,但是:

    footer{
        position:absolute;
        bottom: 0;
    }  
    

    应该正确放置页脚。然后为其他元素添加 padding 以避免它们覆盖页脚。

    【讨论】:

    • 不完全。这会阻止高度拉伸,但它只是将其放置在第一个 DIV 的中心。为了提供更多上下文,我在受影响的 Joomla 页面中添加了代码。它包含四个 100% 高度的 DIV。然后应该通过 index.html 将页脚添加到页面末尾,但它似乎位于第一个 DIV 内。
    猜你喜欢
    • 2013-04-25
    • 2019-08-11
    • 2012-04-30
    • 1970-01-01
    • 1970-01-01
    • 2015-08-17
    • 1970-01-01
    • 2010-10-17
    • 2014-10-24
    相关资源
    最近更新 更多