html - 具有 flex 布局的网站内容包装器

标签 html css responsive-design

当我显示内容时,我的网站出现问题,有时它会与页脚重叠,并且包装器不会根据内容大小更改大小,因为我已将其设置为绝对值。所以我应该寻找一个“flex ”选项来解决这个问题我一直在网上搜索任何东西,所以我有点迷路了。如何设置包装器的高度,以便完全包含文本并且页面足够长以包含它而不使其与页脚重叠而不使用绝对值?

Here是问题的jsfiddle。包装器的 css 代码如下:

.wrapper {
    height: 500px;
    margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
}

最佳答案

你需要给你的包装类 height:auto !important 。那么下面将是包装类的样子..

.wrapper {
    height: auto !important;
    margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
    overflow:auto;
}

如果可能,请尝试将页脚放在 wrapper 之外。这实际上对我有用。

这是更新后的 fiddle 。

Updated Fiddle

关于html - 具有 flex 布局的网站内容包装器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23007692/

相关文章:

css - 当我使用 jquery 更改 div 类时,AngularJs 翻译指令停止工作

css - viewport user-scalable=yes 和媒体查询

javascript - 如何使用移动版 Safari 在客户端下载数据?

html - CSS 悬停整行以及单个单元格

html - 设置网格样式结果的问题

css - 从全局 SCSS 导入 SCSS 文件夹

html - 在<style>和<script>vuejs中导入有什么区别?

css - 覆盖样式组件中子样式的最佳方法

html - 在一页上覆盖 CSS 样式

css - 如何在 Web 应用程序中使用 SVG Logo ?