HTML5 body設(shè)置自適應(yīng)全屏
發(fā)布時間:2020-05-07 16:15:07 作者:kingrome2009
我要評論
這篇文章主要介紹了HTML5 body設(shè)置自適應(yīng)全屏,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
用什么代碼實(shí)現(xiàn)?不允許有白色底色產(chǎn)生,因為手機(jī)高度不一樣
設(shè)計圖要標(biāo)準(zhǔn)(750)確認(rèn)是背景圖(通屏底圖)應(yīng)用場景:移動端宣傳頁面或者活動頁面
錯誤的寫法:加到div中結(jié)合圖片設(shè)置min-height,但是頁面不會回彈
終極方案
html,body{
width:100%;
height:100%
}
body{
font-family: "華文細(xì)黑";
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;
}
到此這篇關(guān)于HTML5 body設(shè)置自適應(yīng)全屏的文章就介紹到這了,更多相關(guān)HTML5自適應(yīng)全屏內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章
- 這篇文章主要介紹了HTML頁面自適應(yīng)寬度的table(表格),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)2020-06-16
html5移動端自適應(yīng)布局的實(shí)現(xiàn)
這篇文章主要介紹了html5移動端自適應(yīng)布局的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)2020-04-15
HTML5 textarea高度自適應(yīng)的兩種方案
這篇文章主要介紹了HTML5 textarea高度自適應(yīng)的兩種方案,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起2020-04-08關(guān)于html選擇框創(chuàng)建占位符的問題
今天給大家普及在html選擇框創(chuàng)建占位符的問題,文中通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友參考下吧2021-06-09


