How to put a border over a HTML5 video with CSS3 -
i building website centered video, problem inside video black lines 1 on right side on on left, aren't big bugging me , colleagues.
then had idea of laying tiny border same color background inside video element this:
#vid { position: float; margin-top: 100px; height: 480px; width: 854px; border: 3px solid #ececec; box-sizing: border-box; }
<video id="vid" loop autoplay autobuffer controls muted> <source type="video/mp4" src="http://www.mh-content.de/mh/video/muh_film_s_1.mp4"> </source> <source type="video/webm" src="http://www.mh-content.de/mh/video/muh_film_s_1.webm"> </source> <source type="video/ogg" src="http://www.mh-content.de/mh/video/muh_film_s_1.ogg"></source> </video>
box-sizing
this site. uploaded there no border visible. tested on normal div box without video , working fine. tried putting video in div container , applying box-sizing: border-box
attribute container, still no border visible. any appreciated :)
the position element not accept value of float. please see http://www.w3schools.com/css/css_positioning.asp list of accepted css values.
i'm not entirely sure why got downvote, apart css error, can assume person did it, did not understand border in video part of video , no fault of own.
the following solution puts video within box framed div has border on it.
.vid-border{ position: relative; height: 480px; width: 854px; border: 5px solid black; overflow: hidden; } #vid { position: absolute; top:-5px; left:-5px; height: 480px; width: 854px; }
<div class="vid-border"> <video id="vid" loop autoplay autobuffer controls muted> <source type="video/mp4" src="http://www.mh-content.de/mh/video/muh_film_s_1.mp4"> </source> <source type="video/webm" src="http://www.mh-content.de/mh/video/muh_film_s_1.webm"> </source> <source type="video/ogg" src="http://www.mh-content.de/mh/video/muh_film_s_1.ogg"></source> </video> </div>
play width , height of vid-border box overlay video.
Comments
Post a Comment