gpt4 book ai didi

html - Twitter Bootstrap 中的 Div 崩溃

转载 作者:太空宇宙 更新时间:2023-11-04 09:55:09 25 4
gpt4 key购买 nike

我正在尝试通过 Bootstrap 将 Google map 添加到 2 列网格。我遇到了一个问题,但是 map 所在的列已经“折叠”,所以我只能看到应该嵌入的 map 的最顶部。我试过将 html 和 body 元素设置为 100% 高度,然后将 map 所在的 div 设置为 30%,但没有成功。我错过了什么吗?下面的代码...

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Basic Bootstrap Template</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional Bootstrap theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<style>
html{height:100%;}
body{height:100%;}
#map{height:30%;}
</style>
</head>
<body>
<div class="container">
<div class="page-header">
<h1>Testing</h1>
</div>
<div class="row">
<div class="col-md-3">
<form>
<input type="range" name="points" min="0" max="1000">
</form>
</div>
<div id ="map" class="col-md-9">
</div>
</div>
</div>
<script>
var map;
var mapDiv = document.getElementById('map');

var placesMap = {
belfast: {
center:{lat: 54.605035, lng:-5.832087},
population:50000
},
lisburn: {
center:{lat: 54.516246, lng:-6.058010599999989},
population:40000
},
portadown: {
center:{lat: 54.420333, lng:-6.454839},
population:30000
},
bangor: {
center:{lat: 54.643786, lng:-5.624201},
population:20000
}
};

//Called on page load by callback attribute in Google Maps API script source
function initMap() {
map = new google.maps.Map(mapDiv, {
center:{lat:54.605035,lng:-5.832087},
zoom:8
});

for (place in placesMap) {
var placeCircle = new google.maps.Circle({
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35,
map: map,
center:placesMap[place].center,
radius: Math.sqrt(placesMap[place].population) * 100
});
}
}
</script>
<!-- Google api script -->
<script async defer src="https://maps.googleapis.com/maps/api/js?key=MyKeyRemoved&callback=initMap"></script>

</body>
</html>

最佳答案

用它来解决你的问题

#map{height:250px;}

关于html - Twitter Bootstrap 中的 Div 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38792291/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com