【问题标题】:Positioning footer定位页脚
【发布时间】:2016-08-01 10:39:17
【问题描述】:

由于我的页脚 HTML 标记切换位置,我无法定位它。 正如您在我的 IDE 中看到的那样,我已将页脚设置在 HTML 部分的最底部。但是,一旦我运行我的应用程序,它就会向上移动 2 行来改变位置。

是不是因为remodal-pop box的配置?知道如何解决这个问题吗? 这是图片,以便更容易理解。

这是我的 css-footer 代码:

.footer {
     position: absolute;
     right: 0;
     bottom: 0;
     left: 0;
     padding: 1rem;
     text-align: center;
     background: #2E3438;
     color:white;
     height: 23px;
     line-height: 8px;
     font-size: 13px;         
}

以及由于 remodal-pop 错误而无法更改的 html 和正文:Twitter Bootstrap modal pushes html content to the left

html {
  overflow: hidden;
  height: 100%;
}
body {
  overflow: auto;
  height: 100%;
}

EDIT(在给出答案之后): 这是您需要更改的代码(追加到前面)文件的名称是 jquery.remodal.js:

if (!remodal.$overlay.length) {
      remodal.$overlay = $('<div>').addClass(namespace + '-overlay');
      remodal.$body.prepend(remodal.$overlay);
    }

    remodal.$bg = $('.' + namespace + '-bg');
    remodal.$closeButton = $('<a href="#"></a>').addClass(namespace + '-close');
    remodal.$wrapper = $('<div>').addClass(namespace + '-wrapper');
    remodal.$modal = $modal;
    remodal.$modal.addClass(namespace);
    remodal.$modal.css('visibility', 'visible');

    remodal.$modal.prepend(remodal.$closeButton);
    remodal.$wrapper.prepend(remodal.$modal);
    remodal.$body.prepend(remodal.$wrapper);

【问题讨论】:

  • 如果生成了 .remodal-overlay.remodal-wrapper。它们将始终出现在底部,除非您尝试在 .footer 上方创建 div 并设置 remodal-overlayremodal -wrapper 仅在您制作的 div 内生成
  • 从 HTML5 开始,我们使用footer 标签。我邀请你看看它。
  • @html 5 页脚与否,它再次保持不变
  • @MarkSoliver 这就是我的想法,tnx 建议 div!
  • @none 那是评论...不是答案...无论如何,您是否在其他浏览器中尝试过?

标签: html css


【解决方案1】:

您的remodal js 脚本只是将那些div-s 附加到准备好的文档中。

正如我在 remodal 主页上看到的那样,它们都是 position: fixed,所以只要您没有更改这些 remodal 容器的样式 - 它们就无法移动您绝对定位的页脚。

问题可能出在其他地方。您可以修改 remodal 脚本并预先添加(或放置在其他位置)这些容器,但我认为这并不重要。

也许其中一种 remodal 样式有问题?您可以从 DOM 中删除样式进行测试(仅保留 js)。

【讨论】:

  • 哈哈,我不相信在查了所有相关的附件之后它现在可以工作了!! Tnx男人,当之无愧的+100。 .prepends 工作完美。我得等 23 小时才能奖励你...
  • 顺便说一句。 @none - 你能准确地发布应该更改哪个 append 吗?我认为这会对其他人有所帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-09-18
  • 2017-03-06
  • 2016-11-06
  • 1970-01-01
  • 2017-09-25
  • 2014-03-23
  • 2011-07-06
相关资源
最近更新 更多