[英]Make a full screen CSS background image appear “behind” a mobile keyboard
[英]full page Background image behind google maps does not appear in the html output
我有一個加載谷歌地圖的html頁面。我想使用圖像作為背景來覆蓋整個html頁面。 但是由於某種原因,背景圖片沒有出現,但是Google地圖在指定的div中加載。 我的文件如下(markerdrop.html):
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple markers</title>
<link rel="stylesheet" type="text/css" href="markerdropstyle.css" />
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
var mapOptions = {
zoom: 4,
center: myLatlng
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Hello World!'
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
和markerdroptsyle.css:
html{
/* This image will be displayed fullscreen */
background:url("images/myimage.jpg") no-repeat center center;
/* Ensure the html element always takes up the full height of the browser window */
min-height:100%;
/* The Magic */
background-size:cover;
}
body{
/* Workaround for some mobile browsers */
background:url("images/myimage.jpg") no-repeat center center;
/* Ensure the html element always takes up the full height of the browser window */
min-height:100%;
/* The Magic */
background-size:cover;
min-height:100%;
}
#map-canvas {
height: 500px;
width: 500px;
}
好,
將CSS更改為以下對我有用:
body {
background-image: url("images/myimage.jpg");
background-size:cover;
}
div#map-canvas
{
width:500px;
height:250px;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.