asp.net做毕业设计网站,网络营销的特点举例说明,广州新际网站建设公司怎么样,优质网站建设哪家好一、问题描述#xff1a;
在使用h5开发页面时#xff0c;会遇到这个情况#xff1a;当整个页面高度不足以占满显示屏一屏#xff0c;页脚不是在页面最底部#xff0c;影响用户视觉。想让页脚始终在页面最底部#xff0c;我们可能会想到用#xff1a;
1.min-height来控…一、问题描述
在使用h5开发页面时会遇到这个情况当整个页面高度不足以占满显示屏一屏页脚不是在页面最底部影响用户视觉。想让页脚始终在页面最底部我们可能会想到用
1.min-height来控制content中间内容区高度来让页面高度能够占满显示屏一屏但是大型网站页面比较多的情况下footer都是模块化添加进去的每个页面高度都不会一样不可能去设置每个页面中间内容区min-height高度而且用户的显示屏的大小都不一样无法精确设置min-height高度无法保证用户看到页面页脚不是在最底部或页面不出现滚动条
2.页脚固定定位页脚相对于body固定定位会显示在最底部但是页面有滚动条时页面滚动页脚会悬浮在内容区上可能以上都不是你想要的效果。
二、解决方式 以下两种方式都可以解决亲测好用 1.第一种方式 body!-- 头部 --div classheader头部/div!-- 内容--div classcontent内容部分/div!-- 产品--div classproduct产品部分/div...!-- 底部 --div classfooter底部内容..../div/bodystylebody{position: relative; /* 设置定位*/padding-bottom: 360px !important; /*这个高度等于底部的高度*/box-sizing: border-box;min-height: 100vh; /*给body设置一个最小高度*/}/* 底部*/.footer {width: 100%;height: 360px; /* 必须要有明确的高度*/overflow: hidden;background: #141419;box-sizing: border-box;position: absolute; /* 设置定位*/bottom: 0px;left: 0px;}/*以上设置在PC端和手机端是没有问题的。*//style
2.第二种方式 !DOCTYPE html
htmlheadmeta charsetUTF-8title/title/headstyle* {margin: 0;padding: 0;}html,body {height: 100%;font-size:40px;}#container {position: relative;width: 100%;min-height: 100%;padding-bottom: 100px;box-sizing: border-box;}.header {width: 100%;height: 200px;background: orange;}.main {width: 100%;height: auto;min-height: 200px;background: yellow;}.footer {width: 100%;height: 100px;/* footer的高度一定要是固定值*/position: absolute;bottom: 0px;left: 0px;background: green;}/stylebodydiv idcontainerdiv classheader头部/divdiv classmain中间内容/divdiv classfooter底部/div/div/body/htmlOK完成~