<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>皇居マップ</title>
<!-- Leaflet CSS -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.css"
/>
<style>
/* 全体リセット */
html, body {
height: 100%;
margin: 0;
padding: 0;
font-family: "Hiragino Sans", "Helvetica", sans-serif;
}
/* -------------------------
ヘッダー
------------------------- */
header {
position: fixed;
top: 0;
left: 0;
width: 100%;
padding: 10px 15px;
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(4px);
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
z-index: 1000;
display: flex;
justify-content: space-between;
align-items: center;
}
header h1 {
font-size: 18px;
margin: 0;
font-weight: bold;
}
header span {
font-size: 13px;
color: #444;
}
/* メイン地図(ヘッダーの下にピッタリ) */
#map {
position: absolute;
top: 60px; /* ヘッダーの高さだけ下げる */
bottom: 0;
left: 0;
right: 0;
}
/* -------------------------
スマホ最適化
------------------------- */
@media (max-width: 600px) {
header h1 {
font-size: 16px;
}
header span {
font-size: 12px;
}
}
</style>
</head>
<body>
<!-- ヘッダー -->
<header>
<h1>皇居マップ</h1>
<span>OpenStreetMap / Leaflet</span>
</header>
<!-- 地図 -->
<div id="map"></div>
<!-- Leaflet JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js"></script>
<script>
// 地図生成
const map = L.map('map').setView([35.685175, 139.7528], 15);
// OSMタイルレイヤー
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors',
maxZoom: 19
}).addTo(map);
// 皇居中央マーカー
L.marker([35.685175, 139.7528])
.addTo(map)
.bindPopup("皇居").openPopup();
</script>
</body>
</html>