用什么代码实现?不允许有白色底色产生,因为手机高度不一样
设计图要标准(750)确认是背景图(通屏底图)应用场景:移动端宣传页面或者活动页面
错误的写法:加到div中结合图片设置min-height,但是页面不会回弹
终极方案
html,body{ width:100%; height:100% }
body{ font-family: "华文细黑"; background:url("../img/Flyer-bg.png") no-repeat; background-size: 100%; }
一个hack方案解决垂直剧中问题
<head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width,minimum-scale=1.0"> <title>缓存</title> <script src="js/jquery-1.8.2.min.js"></script> <script src="js/store.min.js"></script> <style> .parent{ width:200px; height: 200px; /* 以下属性垂直居中 */ position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; background-color: #aaa; } </style> </head> <body> <div class="parent">111</div> </body>
其他方案
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <div id="Layer1" style="position:fixed; left:0px; top:0px; width:100%; height:100%"> <img src="https://www.qianbuxian.com/uploads/banners/20171214085954_shouye5.jpg" width="100%" height="100%"/> </body> </html>
清除浮动
.float-left { float: left; } .float-right { float: right; } .clear-fix:after { display: table; content: ''; clear: both; }
到此这篇关于HTML5 body设置自适应全屏的文章就介绍到这了,更多相关HTML5自适应全屏内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本之家!
首先提示,处于安全的需要JavaScript不能直接访问本地资源文件,那怎么办呢?下...
问题描述 按钮样式为图标+文字,在使用flex布局写垂直居中时,iphone7手机上文字...
用什么代码实现?不允许有白色底色产生,因为手机高度不一样 设计图要标准(750...
复制代码 代码如下: html !--混合框架的布局: 要想实现复杂的页面布局,只需在f...
一、前言 在了解加密原理前,我们来看看这样一个故事。 小红和小明是情侣,一天...
创业公司常常能给我们带来惊喜,不拘一格的工作方式,别开生面的商业模式,独树...
1. 给logo添加替代文本 这样有两个好处:屏幕阅读器能识别logo图片代表的含义,...
最近在开发中遇到的需求是:微信扫描课件二维码,播放其对应的课件视频 设计流程...
em是何物? em指字体高,任意浏览器的默认字体高都是16px。所以未经调整的浏览器...
大家好,我是民工哥。 一提到监控系统,大家很快就能想到 Zabbix 、 Prometheu s...