【发布时间】:2021-09-02 08:55:41
【问题描述】:
我有一个全屏的 Google Maps Div,我添加了一个输入用作搜索框。这是代码:
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
width: 100%;
position: fixed;
}
.container, .container > div, .container > div #map {
height: inherit;
}
.mapcanvas {
display: block;
position:absolute;
height:100%;
bottom:0;
top:0;
left:0;
right:0;
margin-top:0px; /* adjust top margin to your header height */
}
</style>
<body onload="initializeMap()">
<div id="map" class="mapcanvas"></div>
<input class="form-control" placeholder="Insert the place you are looking for" type="text" id="input_location">
</div>
</body>
<script>
function initializeMap() {
map = new google.maps.Map(document.getElementById("map"),
{
tilt:0
,center:new google.maps.LatLng(41.946, 13.499)
,zoom:7
,mapTypeId: google.maps.MapTypeId.SATELLITE
,mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
position: google.maps.ControlPosition.BOTTOM_CENTER
}
}
);
const input = document.getElementById("input_location");
const searchBox = new google.maps.places.SearchBox(input);
map.controls[google.maps.ControlPosition.TOP_CENTER].push(input);
}
</script>
当我在智能手机上打开这个页面时,搜索框非常非常小。
我怎样才能控制这个的大小?我尝试使用 Bootstrap 类 class="form-control form-control-lg" 和 style="font-size:36px",但没有任何反应。
有什么想法吗?
【问题讨论】:
标签: css google-maps-api-3 responsive-design responsive