Html 页脚出现在页面的中间?

Html 页脚出现在页面的中间?,html,css,web,Html,Css,Web,我的页脚不会显示在底部,它会显示在除此之外的所有其他页面上(代码如下)。页脚中的内容出现在底部(组件的错误位置,但仍在底部),但背景颜色在页面的中间。 代码如下: <footer id="fots"> <div id="infof"> <div id="infoc"> <ul class="ulfot" id="ulfk">

我的页脚不会显示在底部,它会显示在除此之外的所有其他页面上(代码如下)。页脚中的内容出现在底部(组件的错误位置,但仍在底部),但背景颜色在页面的中间。

代码如下:

<footer id="fots">
            <div id="infof">
                <div id="infoc">
                    <ul class="ulfot" id="ulfk">
                        <li><b>Destinatons</b></li>
                        <li>London</li>
                        <li>Sarajevo</li>
                        <li>Istanbul</li>
                        <li>Gothenburg</li>
                    </ul>
                    <ul class="ulfot">
                        <li><b>Flight info</b></li>
                        <li>Before flying</li>
                        <li>When flying</li>
                        <li>After flying</li>
                    </ul>

                </div>
            </div>

            <div id="fotsd">
                <div id="leftis">   
                    <p><b> &copy something </b></p>
                </div>
                <div id="rightis">
                    <a href="#" id="bks">Back to top <span class="glyphicon glyphicon-arrow-up"></span> </a>
                </div>
            </div>  
        </footer>

如果我理解正确,这就是您想要的:

更改此CSS

#fots{
background-color: #ebebeb;
width: 100%;
}
为此:

#fots{
background-color: #ebebeb;
width: 100%;
position:fixed; /*new*/
bottom:0;/*new */
}
#infof{
width: 100%;
/*height: 180px;*/ /*removed*/
background-color: gray;
}
并更改此CSS:

#infof{
width: 100%;
height: 180px;
background-color: gray;
}
为此:

#fots{
background-color: #ebebeb;
width: 100%;
position:fixed; /*new*/
bottom:0;/*new */
}
#infof{
width: 100%;
/*height: 180px;*/ /*removed*/
background-color: gray;
}

根据(第一个谷歌结果…)的说法,将位置设置为绝对应该将其保持在底部。

这种方式有效,所有的页脚都在一个位置,但现在它被固定在实际浏览器屏幕的底部,因此当您上下滚动时,您将始终看到浏览器屏幕底部的页脚。我如何让它停留在页面底部而不是浏览器屏幕上?(抱歉,我的评论太长,可能无法理解)@SheikhAbdiMahmood请查看我的回答,以回答您的评论,而不是立场:绝对,请确保您将您的
标记前面的code>,和/或查看@dippasanswer@dippas还有J-Dizzle,非常感谢你的回答,但它仍然不起作用。由于页脚在其他页面上运行良好,我怀疑页脚代码之前正文的其他地方可能有问题。然后显示此页面的链接,可能是无效的html或缺少结束标记。