html - 响应式页脚在移动设备上位于顶部;粘在手机模拟器和桌面上的底部?

标签 html css mobile responsive-design footer

最近部署了一个带有最少插件的响应式 word press 模板。 Footer 适用于手机模拟器和桌面。在实际设备上,它拍摄到内容上方标题的正下方。我希望页脚贴在底部。

我的手机测试设备是 nexus 5(1080p)。

我试过按照通常的建议更改页脚,但对两者都不起作用。我什至关闭了用于确定移动设备的 php 函数,但它仍然不起作用。

这是页脚 CSS

这是响应式 CSS 和 php 代码

    if ($px_theme_option['responsive'] == "on") {
                    echo '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">';
                    wp_enqueue_style('responsive_css', get_template_directory_uri() . '/css/responsive.css');

CSS(来自 responsive.css 的相关页脚类)

/*============      Media 768Px Start   ============ */
@media (min-width: 768px) and (max-width: 979px) {


    #footer{
            overflow:hidden;
        }

/*============      Media 420Px Start   ============ */
@media (max-width: 767px) {
    #footer{
        height:67px;
}
    #footer p{
        margin:0 0 0 10px;
    }
    #footer{
        overflow:hidden;
    }


/*============      Media 300Px Start   ============ */
@media (max-width: 480px) {

#footer{
        height:120px;
    }
    #footer p{
        margin:0;
        padding:0px 44px 0px 0px;
    }   

可能是相关的,新闻文章就在最上面,并且覆盖了它们。我假设它在下面拍摄并且它不适用(因为我在世界新闻和页面中切换了一些类别?)。

.news-section article figure{
    height:100%;
    }
    #footer p{
    margin:0 0 0 10px;
}


    #footer{
        overflow:hidden;
    }
/*============     Media 940Px Start    ============ */
@media screen and (min-width: 900px) and (max-width: 1054px){

    #footer{
        overflow:hidden;
    }

默认(我假设是桌面,因为它在单独的 style.css 文件中)

  #footer {
        max-width: 1160px;
        margin: 0 auto;
        background: #141414;
        position: relative;
        z-index: 99;
        height: 56px;
        font-size: 0;
        line-height: 0;
        padding-top: 17px;
        border-top: 10px solid #0c0c0c;
        box-shadow: -10px 10px #141414,10px 10px #141414 ;
    }
    #footer p {
        float: left;
        line-height: 25px;
        margin: 0 0 0 35px;
        font-size: 11px;
        color: #555;
        font-style: normal;
    }

页脚 HTML

      </div>
            </div> 
        </div>
        <!-- Inner Main -->
    </div>
    <footer id="footer">
        <p class="coptyright">
            <?php echo do_shortcode(htmlspecialchars_decode($px_theme_option['copyright'])); ?>  
            <?php echo do_shortcode(htmlspecialchars_decode($px_theme_option['powered_by'])); ?>
        </p>
        <?php
            if($px_theme_option['footer_social_icons'] == 'on'){
                px_social_network();
            }
        ?>
        <a href="" class="btn btngotop"><i class="fa fa-arrow-circle-o-up"></i></a>
    </footer>
</div>
<!-- Wrapper End -->
<?php 
px_footer_settings();
wp_footer();?>
</body>
</html>

最佳答案

尝试添加

clear:both

这应该将其保留在底部。

关于html - 响应式页脚在移动设备上位于顶部;粘在手机模拟器和桌面上的底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25772865/

相关文章:

javascript - 在 React Native 应用程序开发中从 ModelDropdown 获取文本

html - 将 html 输出打印到服务器应用程序上的打印机

css - 如何向元素或容器添加可变宽度,而不是固定宽度?

c# - 在 Asp.net MVC 中将移动设备的重定向代码放在哪里

html - 绝对定位的嵌套元素上的 z-index

javascript - classList toggle(show) 不显示下拉内容

javascript - 在 javascript 中检测屏幕上的虚拟键盘和横向

javascript - 如何在 html 5 中创建鼠标悬停高亮框?

javascript - 输入值更新困境

html - 修复了 Bootstrap 中的导航栏