-
名称: 汽车修理厂 1
地址: 123 主街,任意城 CA 90210
电话: (555) 123-4567
-
名称: 汽车修理厂 2
地址: 456 侧街,任意城 CA 90210
电话: (555) 234-5678
-
名称: 汽车修理厂 3
地址: 789 大道,任意城 CA 90210
电话: (555) 345-6789
js
// JavaScript
const map = L.map('map').setView([34.0522, -118.2437], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {attribution: '©
OpenStreetMap
contributors'
}).addTo(map);const markers = [[34.0528, -118.2405, '汽车修理厂 1'],[34.0542, -118.2393, '汽车修理厂 2'],[34.0556, -118.2381, '汽车修理厂 3']
];for (const marker of markers) {L.marker(marker.slice(0, 2)).addTo(map).bindPopup(marker[2]);
}
css
/ CSS /
map {height: 500px;
}list {width: 50%;float: right;
}list ul {list-style-type: none;padding: 0;
}list li {margin-bottom: 10px;
}list strong {font-weight: bold;
}