Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a way to show text on Leaflet map using markers or anything else without showing any icon. I want to show text only and be able to style and rotate it... Any suggestion?

Thanks a lot


share|improve this question
up vote 12 down vote accepted

I solved my problem by using the Leaflet L.DivIcon feature that represents a lightweight icon for markers that uses a simple div element instead of an image... These markers have an html and a className options that allow me to create labels with css drived styles...


share|improve this answer
Would you mind providing a little bit of code for this? – mastov May 13 at 9:13

Use the Leaflet Label Plugin (already mentioned by geomajor56).

<script src="scripts/leaflet.label.js"></script>

With the Leaflet Label plugin, labels are directly tied to markers, but you can set the opacity of the marker to almost zero so only the label is visible. (If you set the marker's opacity to 0, the associated label disappears as well.)

var marker = new L.marker([39.5, -77.3], { opacity: 0.01 });
marker.bindLabel("My Label", {noHide: true, className: "my-label", offset: [0, 0] });

You can then use CSS to style your labels as you see fit:

.my-label {
    position: absolute;
share|improve this answer
<script src="scripts/leaflet.label.js"></script> - After I've added this line to my HTML the page appeared to be blank. Do I need to download any files? – Marcin Kosiński Jun 5 at 19:15
@MarcinKosiński - Yes, you'll need to download leaflet.label.js from the GitHub link in the post, and put it in a subfolder of your website named scripts. Or, you can replace the URL in the code with the hosted file at (you may also want the CSS file; same name and location, different extension). – KeithS Jul 18 at 20:55

You can start here with this Leaflet plugin. Probably create or edit a marker to your liking. Is the text coming from feature attributes?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.