In short
A Leaflet map needs the library styles, the library file, and a map container with a real height.
Use [latitude, longitude] for geographic points. For a floor plan, use CRS.Simple and define your own bounds.
Test one marker, the full-map view, and an invalid value before sharing.
The finished fictional venue map below worked in the NOS editor and from its public phone-width link.
We rebuilt the example as a fictional night-market guide. The completed page has an inline venue plan, three numbered locations, popups, a button that restores the full view, and a visible error message for a coordinate that the plan cannot accept. No real place or visitor data appears in it.
The important choice was to keep the plan inside the file. A street map normally requests image tiles from a separate provider. This venue example uses an inline drawing instead, so the map remains useful when the page cannot reach an outside tile service.
How do you make an interactive map website with Leaflet?
Start with the smallest complete result, not a long list of features. The official Leaflet 1.9 guide shows the same core structure: load the stylesheet, load Leaflet 1.9.4, give the map container a height, and create the map after that container exists.
- Choose the map type. Use geographic coordinates for a street map. Use
CRS.Simplefor a floor plan, game board, seating plan, or other flat drawing. - Give the map a fixed starting height. A container with no height is present in the page but has no area in which to draw.
- Add one known point first. Confirm that the marker appears where expected before importing a longer location list.
- Fit the full bounds. This gives visitors a reliable way back after they pan or zoom.
- Show errors in the page. A bad coordinate should produce a useful message instead of a silent blank map.
Download the complete fictional map example
The download is the full example used for these checks. Open it while connected to the internet because it loads Leaflet 1.9.4 from a content delivery network. The venue drawing and location data are contained in the file.

After the file was in NOS, View showed the same three markers and the ready message. The narrow layout kept the zoom controls, status, and both action buttons within the page width.

What should the finished map do before you share it?
A map is not finished merely because its background appears. Check a small path that proves the page responds to a visitor:
- Open the page at phone width.
- Tap one numbered marker and confirm that the correct name appears.
- Pan or zoom, then use the reset control to restore the whole plan.
- Try a value outside the accepted range and confirm that the page explains the problem.
- Open the public address rather than relying only on the editor preview.
We created the reader link from the Share panel. The captured panel says anyone with that link can read the page without signing in and cannot edit it.

The ordinary Edit view also preserved the interactive page. We did not change the browser security setting or replace the preview with a different page.

Does the Leaflet map work on a mobile link?
The public phone-width page showed all three markers, the full venue plan, and the ready message. The page disables wheel zoom so a desktop reader can scroll past the map without the map taking over the wheel. Touch and the visible zoom buttons remain available.

Marker 2 opened the Lantern Stage popup when tapped. That check matters because a marker can look correct while its label or click target points to the wrong record.

Completed result: the same public address displayed the full plan, accepted a marker tap, and showed a readable fallback message for the tested bad value. Those three states cover the basic reader path for this example.
Why is a Leaflet map blank or grey?
Check the container before changing the marker data. Leaflet draws into the element you give it. If that element has no height, the page can show every other part correctly while the map has no visible area.
If the map was created while its panel was hidden, reveal the panel and ask Leaflet to measure it again with invalidateSize(). If controls and tiles appear as scattered page elements, confirm that the Leaflet stylesheet loaded. If the browser says L is not defined, the Leaflet file was unavailable or your map code ran before it loaded.
Why does a marker appear in the wrong place?
Leaflet geographic points use [latitude, longitude]. In a GeoJSON position, the order is longitude, then latitude. Leaflet reads GeoJSON correctly when you pass the full GeoJSON object, but a number pair copied by hand may need to be reordered before it goes into a Leaflet marker.
A flat plan needs a different rule. In this example, valid values stay inside the drawing bounds. The error control demonstrates what the page does when the latitude value falls outside that range.

Where do street-map tiles come from?
Leaflet draws the interface, markers, shapes, and popups. A street background usually comes from a separate tile provider. That provider has its own terms, attribution rules, and availability. The OpenStreetMap Foundation policy requires visible attribution for its tile service and describes availability as best effort.
If a street layer works locally but disappears after publication, check the tile provider request and the rules of the place hosting the page. Do not remove attribution to make space. For a venue plan that does not need streets, an inline SVG overlay avoids the outside tile request altogether.
For a library-free diagram, see map markers in HTML. For another full mapping library, compare OpenLayers in one HTML file. If visitors only need directions to one address, a link to a map location is simpler.
When not to do this
- Do not build an interactive map when a plain address link gives the reader everything needed.
- Do not use the public OpenStreetMap tile service as an unlimited production service; read its current policy and choose a suitable provider.
- Do not place private customer, employee, or precise personal-location data in a public example.
- Do not hide a failed data load behind an empty map. Show the reader what needs to be corrected.
Using NOS for the map page
NOS Workspace let us open the complete HTML in Code, inspect the map in View and Edit, and create a public reader address from Share. The public example kept its marker popups and status controls. Check the current pricing page if you need to compare plans; this guide does not depend on a quoted price.
Sources checked
- Leaflet 1.9 quick start for the map container, versioned library files, markers, and popups.
- Leaflet installation page for the current 1.9.4 download and the 2.0 prerelease status.
- Leaflet reference versions for the current stable 1.x reference.
- OpenStreetMap tile usage policy for attribution and service limits.