0
http://codepen.io/anon/pen/aBWvMX事業部高度(VW單位?)在IOS野生動物園工作不
預期的行爲是在大窗口大小的黃色和紅色的div是彼此相鄰,並在較小的,他們堆在上面,並滾動。
這適用於PC上的Chrome,Firefox,IE。
這適用於Mac上的Chrome,Firefox,Safari。
這適用於Android上的Chrome。
這對iOS或iOS設備上的Chrome或Safari無效!
取而代之的是IOS設備,它被渲染爲一個巨大的div,對於視口來說太高。另一個div完全沒有出現。
我已經嘗試了一些事情的組合,並且我已經有一些輕微成功的唯一方法是在css中使用@media查詢。我寧願不要這樣做,因爲我不能保證支持每個設備。
HTML:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1, minimum-scale=1, maximum-scale=1, width=device-width, target-densitydpi=device-dpi">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="container-fluid" id="app">
<div class="row" id="bg">
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12" id="pic">
<div class="leftlayer-gradient hidden-md hidden-lg">
</div>
</div>
<div class="col-md-6 col-lg-6 col-sm-12 col-xs-12" id="details">
<div class="rightlayer">
</div>
</div>
</div>
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>
CSS:
#pic, #details {
height: 100vh;
}
#details {
background-color: red;
-webkit-background-size: 100%;
-moz-background-size: 100%;
-o-background-size: 100%;
background-size: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-position: left;
}
#pic {
background-color: yellow;
-webkit-background-size: 100%;
-moz-background-size: 100%;
-o-background-size: 100%;
background-size: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-position: right;
}
.rightlayer {
background-color: rgba(0, 0, 0, 0.5);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.leftlayer-gradient {
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 70%, rgba(0,0,0,0.5)); /* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(bottom, rgba(0,0,0,0) 70%, rgba(0,0,0,0.5)); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(bottom, rgba(0,0,0,0) 70%, rgba(0,0,0,0.5)); /* For Firefox 3.6 to 15 */
background: linear-gradient(to bottom, rgba(0,0,0,0) 70%, rgba(0,0,0,0.5)); /* Standard syntax (must be last) */
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}