Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html>

<head>
  <meta name="description" content="Leaflet Template">
  <title>Simple Map</title>
  <meta name="viewport" content="initial-scale=1.0">
  <meta charset="utf-8">
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" />
</head>
<body>
  <div id="map"></div>
</body>
 <script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
</html>
              
            
!

CSS

              
                /* Always set the map height explicitly to define the size of the div
 * element that contains the map. */
#map {
  height: 100%;
}

/* Optional: Makes the sample page fill the window. */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

.popup-content {
  width: 300px;
}
		
.popup-content .left {
  float:left;
  width: 40%;
}
.popup-content .left img {
  width:100%;
  height:100px;
  margin: -11px 0 -15px -20px;
  border-radius:12px;
}

.popup-content .right {
  float:left;
  width: 60%;
}

.clearfix {
  clear:both;
}
              
            
!

JS

              
                var map = L.map('map').setView([21.02014554822514, 105.784259312448], 13);

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
  attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

 // Add custom marker
var markerCoord = [21.02014554822514, 105.784259312448]; // Toạ độ marker
var popupOption = {
  className: "popup-content",
  closeOnClick: false
};
 var popupContent = `
 <div class='left'>
     <img src='https://cellphones.com.vn/sforum/wp-content/uploads/2018/11/2-8.png' />
 </div>
 <div class='right'>
     <p>"<strong>Hello Everyone!</strong> <br> Welcome to my map!!!!"</p>
 </div>
 <div class='clearfix'></div>`;

var marker = L.marker(markerCoord).addTo(map);
var inforWindown = L.popup(popupOption)
.setLatLng(marker.getLatLng())
.setContent(popupContent);
marker.bindPopup(inforWindown);
inforWindown.openOn(map);
marker.bindTooltip("Tooltip !!!");

              
            
!
999px

Console