Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Display a map</title>
    <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
    <meta charset='utf-8'>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@4.1.0/dist/maplibre-gl.css' />
    <script src='https://unpkg.com/maplibre-gl@4.1.0/dist/maplibre-gl.js'></script>
    <style>
        body { margin: 0; padding: 0; }
        html, body, #map { height: 100%; }
        .marker2d {
        display: block;
        border: none;
        border-radius: 50%;
        background-color: red;
        width: 70px;
        height: 70px;
        cursor: pointer;
        padding: 0;
    }
    </style>
</head>
<body>
<div id="map"></div>
<script>
    const map = new maplibregl.Map({
        container: 'map', // container id
        style: 'https://demotiles.maplibre.org/style.json', // style URL
        center: [12.4822, 41.8967], // starting position [lng, lat]
        zoom: 4, // starting zoom
        maplibreLogo: true
    });
    let el = document.createElement('div');
    el.className = 'marker2d';
    let marker = new maplibregl.Marker(el)
        .setLngLat([12.4822, 41.8967])
        .addTo(map);
</script>
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers