Inner border with radius on google maps element
This is the only way I have found so far to be able to have a usable google maps element with a inner border and border radius. This could be achieved using less extra markups though, but it wouldn't be suitable for high radius values.
HTML
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&dummy=.js"></script>
<div class="wrapper">
<div class="map" id="map"></div>
<i class="top"></i>
<i class="right"></i>
<i class="bottom"></i>
<i class="left"></i>
<i class="top left"></i>
<i class="top right"></i>
<i class="bottom left"></i>
<i class="bottom right"></i>
</div>
SCSS
$radius: 10px;
$thickness: 5px;
$border-color: rgba(black, 0.15);
$background-color: white;
.wrapper {
position: relative;
width: 400px;
height: 200px;
overflow: hidden;
margin: 50px;
& > i {
display: block;
position: absolute;
&.top {
top: 0;
border-top: $thickness solid $border-color;
&:after {
top: -$radius/2 - $thickness;
border-top: $radius/2 solid $background-color;
}
}
&.right {
right: 0;
border-right: $thickness solid $border-color;
&:after {
right: -$radius/2 - $thickness;
border-right: $radius/2 solid $background-color;
}
}
&.bottom {
bottom: 0;
border-bottom: $thickness solid $border-color;
&:after {
bottom: -$radius/2 - $thickness;
border-bottom: $radius/2 solid $background-color;
}
}
&.left {
left: 0;
border-left: $thickness solid $border-color;
&:after {
left: -$radius/2 - $thickness;
border-left: $radius/2 solid $background-color;
}
}
&.top:not(.right):not(.left),
&.bottom:not(.right):not(.left) {
height: $thickness;
left: $radius+$thickness;
right: $radius+$thickness;
}
&.left:not(.top):not(.bottom),
&.right:not(.top):not(.bottom) {
width: $thickness;
top: $radius+$thickness;
bottom: $radius+$thickness;
}
&.top.right,
&.top.left,
&.bottom.right,
&.bottom.left {
width: $radius;
height: $radius;
&:after {
content:"";
position: absolute;
width: 1.5*$radius;
height: 1.5*$radius;
}
}
&.top.right {
border-top-right-radius: $radius;
&:after { border-top-right-radius: 1.5*$radius; }
}
&.top.left {
border-top-left-radius: $radius;
&:after { border-top-left-radius: 1.5*$radius; }
}
&.bottom.right {
border-bottom-right-radius: $radius;
&:after {...
JavaScript
new google.maps.Map(document.getElementById("map"), {
zoom: 1,
disableDefaultUI: true,
zoomControl: true,
center: new google.maps.LatLng(28, -41),
mapTypeId: "roadmap"
});