html 响应性地嵌入YouTube,Vimeo,Google地图,iframe等

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 响应性地嵌入YouTube,Vimeo,Google地图,iframe等相关的知识,希望对你有一定的参考价值。

<!-- FROM: http://embedresponsively.com/ -->

<!-- YouTube Responsive Embed -->
<style>.embed-container {position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;} .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style>
<div class='embed-container'>
  <iframe src='http://www.youtube.com/embed/' frameborder='0' allowfullscreen></iframe>
</div>

<!-- Vimeo Responsive Embed -->
<style>.embed-container {position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;} .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style>
<div class='embed-container'>
  <iframe src='http://player.vimeo.com/video/' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</div>

<!-- Google Maps Responsive Embed -->
<style>.embed-container {position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;} .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style>
<div class='embed-container'></div>

<!-- Generic Iframe Responsive Embed -->
<!-- NOTE: You may want to remove any hard coded values you see below with regards to "width" and "height" in the below code. These values may be in the iFrame SRC parameters, or in the iFrame query string. Experiment to see what works best. -->
<style>.embed-container {position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;} .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style>
<div class='embed-container'></div>

以上是关于html 响应性地嵌入YouTube,Vimeo,Google地图,iframe等的主要内容,如果未能解决你的问题,请参考以下文章

如何在没有 Youtube 或 Vimeo 的情况下嵌入视频?

html 响应Vimeo,Youtube视频

如何跟踪嵌入视频(youtube、vimeo 等)的点击事件? (跟踪播放次数)

使用自定义字段从 Youtube 或 Vimeo 嵌入背景视频

php Youtube或Vimeo嵌入

嵌入具有正确纵横比的 Youtube/Vimeo 视频