JSFiddle - React, Tailwind, and code Playground
by Petra1999
HTML
<div class='map'>
<div class="map__location map__location--melanie" data-lat='47.7826' data-lng='12.953326'>
<div class="map__pin"></div>
<div class="map__logo"><img src="https://via.placeholder.com/300/000000/FFFFFF" /></div>
</div>
<div class="map__location map__location--gabi" data-lat='47.787003' data-lng='12.958961'>
<div class="map__pin"></div>
<div class="map__logo"><img src="https://via.placeholder.com/300/000000/FFFFFF" /></div>
<a href="#">Weiter zum Partnerhotel</a>
</div>
<div class="map__location map__location--highway" data-lat='47.786782' data-lng='12.981561'>
<div class="map__info"></div>
<strong>Autobahnausfahrt Wals (A1)</strong><br /> nur 2km entfernt
</div>
</div>
SCSS
* {
box-sizing: border-box;
}
body {
background: gray;
.map__location {
margin-top: 100px;
}
.map__pin {
background: orange;
}
}
.map__location {
background: white;
border: 1px solid #efefef;
padding: 20px 17px;
position: relative;
transform: translateX(-50%);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
&--gabi,
&--melanie {
width: 160px;
}
&--highway {
width: 180px;
}
a {
color: black;
text-decoration: none;
margin-top: 10px;
}
img {
max-width: 100%;
height: auto;
}
}
.map__info {
position: absolute;
top: -15px;
right: -15px;
background: green;
border-radius: 50%;
width: 30px;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-style: italic;
&::after {
content: 'i';
}
}
.map__pin {
position: absolute;
top: -50px;
left: 50%;
transform: translateX(-50%);
width: 50px;
height: 60px;
}