2014-10-31 1 views
0

Google지도를로드하는 html 페이지가 있습니다. 전체 html 페이지를 배경으로 이미지를 사용하고 싶습니다. 그러나 어떤 이유로 배경 이미지가 나타나지 않지만 Google지도가 지정된 div에로드됩니다. 내 파일은 다음과 같습니다 (markerdrop.html) :전체 페이지 Google지도의 배경 이미지가 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; 
      } 
+0

나는 당신의 최종 결과가 어떻게 생겼는지 정말로 확신하지 못한다. 어쩌면 프로젝트의 jsfiddle을 추가 할 수 있습니까? –

+0

귀하의 의견에 감사드립니다 ... 나는 그것을 알아 냈어 다른 것들을 시도한 후. –

답변

0

음,

나를 위해 일한 다음에 CSS를 변경 :

body { 
    background-image: url("images/myimage.jpg"); 
    background-size:cover; 
    } 

div#map-canvas 
    { 
    width:500px; 
    height:250px; 

    } 
관련 문제