Javascript examples for Leaflet:Configuration
apply css on polylines in leaflet
<html> <head> <title>CSS on polylines</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.js"></script> <link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.css"> <style id="compiled-css" type="text/css"> #map { height: 300px; } .my_polyline {/*from w ww . j av a2s. co m*/ stroke: green; fill: none; stroke-dasharray: 10,10; stroke-width: 5; } </style> <script type="text/javascript"> window.onload=function(){ var map = L.map('map').setView([48.858190, 2.294470], 16); L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(map); var latlngs = [ [51.509, -0.08], [51.503, -0.06], [51.51, -0.047], [51.509, -0.08] ]; var polyline = L.polyline(latlngs, { className: 'my_polyline' }).addTo(map); map.fitBounds(polyline.getBounds()); } </script> </head> <body> <div id="map"></div> </body> </html>