对小白极其友好,希望这篇文章是刚刚入门看不懂英文官网的小白的一根救命“稻草”
话不多说,先上代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- 引入openlayers样式 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.9.0/css/ol.css" type="text/css">
<!-- 引入openlayers的js -->
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.9.0/build/ol.js"></script>
<title>OpenLayers example</title>
<style>
.map {
//这样地图可以铺满全屏
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>
</head>
<body>