简体   繁体   English

带有边框图像属性的嵌入式Google地图?

[英]Embedded Google map with border-image property?

JS Fiddle JS小提琴

<div class="banner">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d13004077.93320049!2d-104.65674178116879!3d37.27560719446957!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x54eab584e432360b%3A0x1c3bb99243deb742!2sUnited+States!5e0!3m2!1sen!2sus!4v1513191558069" width="500" height="500" frameborder="0" style="border:0" allowfullscreen></iframe>
</div>

.banner {
border-style: solid;
border-width: 20px 20px 20px 20px;
border-image: url(https://i.imgur.com/5OgMQoX.png) 35 35 35 35;
height: 500px;
width: 500px;
position: relative;
overflow: hidden;

} }

I would like the map to actually fill the border div, ie, reach to the edges of the border image, with the corners rounded so they don't peek through to the other side of the border. 我希望地图实际填充边框div,即到达边框图像的边缘,并且圆角变圆,以免它们窥视边框的另一侧。 Is this something that is even possible? 这有可能吗?

It actually depends on the image and since the border-image you have used is not really rectangular that's why there are gaps between the edges of the iframe and the border-image but I tried to tweak the values around to get it as close as I could get. 它实际上取决于图像,并且由于border-image you have used is not really rectangularborder-image you have used is not really rectangular ,这就是为什么iframe的边缘和border-image之间存在间隙,但是我尝试tweak the values around以使其尽可能接近我可以得到。 Hope, this helps. 希望这可以帮助。

 .banner { border-style: solid; border-image: url(https://i.imgur.com/5OgMQoX.png) 20 35 25 35; border-width: 20px 20px 20px 20px; height: 500px; width: 500px; position: relative; overflow: hidden; padding: 0; } .banner iframe { position: absolute; width: 100%; height: 100%; } 
 <div class="banner"> <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d13004077.93320049!2d-104.65674178116879!3d37.27560719446957!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x54eab584e432360b%3A0x1c3bb99243deb742!2sUnited+States!5e0!3m2!1sen!2sus!4v1513191558069" width="500" height="500" frameborder="0" style="border:0" allowfullscreen></iframe> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM