html - 固定页脚无法正常工作

标签 html css

我正在为我的应用程序使用 jQuery Mobile 1.1.1。 我的 index.html 看起来像:

<div data-role="page" id="home" data-theme="a">
   <div data-role="content">
      <div class="container">
        <div class="row" align="center">                            
        </div>
      </div>
  </div>
  <div class="footer_fixed">   
    <div ><a href="#surveyConductedList"  class="ui-link" > List </a></div>
    <div ><a href="#uploadData"  class="ui-link" > Upload </a></div>
  </div>
</div>

还有页脚的 CSS:

.footer_fixed {
  left: 0;
  right: 0;
  width: 100%;
  position: fixed;
  z-index: 1000;
  bottom:0;
}

但是我的页脚没有显示在屏幕上。它最后显示在屏幕的末尾。我想把它贴在屏幕上并在向下滚动时向下移动

最佳答案

你应该用 attribute selector .

[data-role="footer"] {
    left: 0;
    right: 0;
    width: 100%;
    position: fixed;
    z-index: 1000;
}

或者向您的页脚 添加一个类,因为您没有任何引用.ui-footer-fixed 的类。

编辑:如果你想将页脚设置到底部(通常是footer),你必须设置bottom: 0; 正如 @thepio 指出的那样。我之前没有添加它,因为我想维护你的 CSS 代码,但我在这里添加以避免疑虑。

关于html - 固定页脚无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37137196/

相关文章:

javascript - 比 iframe 更好的替代品来显示选项卡内容?

javascript - 如何在 @Html.Raw(@Url.Action()) 中传递 Javascript List 对象?

javascript - 停止 iframe 捕获鼠标输入

javascript - 将 "current"类添加到单击的元素并在单击另一个元素时将其删除?

html - 为 Chrome 设计一个具有精确宽度的表格

css - 使用 CSS 在 mouseout 上缩放到原始大小

jquery - 使用 jQuery 最小化/最大化 div

android - 'meta name="google-play-app"' 工作吗?

javascript - 如何从工具提示 (tooltipsy) 启动灯箱 (Fancybox)?

css - Div 边框似乎有一个 'pointed' 边缘