[英]Remove iframe border
I am using HTML 5 to add a video on to my webpage, with the use of iframe
. 我正在使用HTML 5将视频添加到我的网页上,并使用iframe
。 Once I add the video it looks like this below: 我添加视频后,如下所示:
As you can see the black border
s around the video, is there anyway I can remove that bit and maybe stretch the video across to match up with the width
of the page? 正如您可以看到视频周围的黑色border
,无论如何我可以删除该位并可能拉伸视频以匹配页面的width
?
This is what I have done for displaying the video : 这就是我为显示视频所做的工作:
<div><iframe src="assets/videos/example.mp4" type="video/mp4" frameBorder="0" width="1280" height="720" allowfullscreen ></iframe></div>
you need to embed your iframe
in a responsive way, something like: 您需要以响应方式嵌入iframe
,例如:
body { margin: 0 } div { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; } iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
<div><iframe src='http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4' type="video/mp4" frameborder='0' allowfullscreen></iframe></div>
Remove width and height from iframe and declare it's height and width in CSS. 从iframe中删除宽度和高度,并在CSS中声明它的高度和宽度。 To match-up with width of your div or browser use width:100%;
要与div或浏览器的width:100%;
匹配,请使用width:100%;
Add This, 添加这个,
HTML HTML
<div><iframe src="assets/videos/example.mp4" frameBorder="0" allowfullscreen ></iframe></div>
CSS CSS
div > iframe {width:100%; height:600px;}
Height - set your height in pixels, how much you want it to be. 高度 - 设置您的高度(以像素为单位),您希望它的大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.