Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Video player shows black border

Tags:

html

css

video

I use a HTML5 video player and it works, but it shows a 1/2 pixel border on the right side. I already checked if it was because the video itself and I tried to set

border:solid 0px black;

but that didn't help.

My current code:

<video id="video" autoplay>
  <source src="intro.mp4" type="video/mp4" id="video">
  Your browser does not support the HTML5 player.
</video>

and the style

#video{
    width:80%; right: 0; top: 0;
    display:none;
    border:solid 0px black;
}

results in

enter image description here

If someone could help me out, I would be really happy :D

Thanks

like image 413
Ahmed Avatar asked Dec 25 '13 10:12

Ahmed


3 Answers

I found the following to be the best solution for removing the 1px border:

video {
    clip-path: inset(1px 1px);
}
like image 59
timbari Avatar answered Sep 22 '22 17:09

timbari


NONE of this is right. This is a focus thing. You need to do:

video:focus { outline:none; }

// or choose a color or transparent or something other if you are needing the focus for ADA/WCAG compliance.

like image 23
KujoCode Avatar answered Sep 23 '22 17:09

KujoCode


it actually a quite known issue. a fix of hide it a bit solves it -> Give the parent element, who wraps the video overflow: hidden and the video (position relative/absolute) left:1px.

Like this:

Html:

<div class="video-wrapper"
  <video id="video" autoplay>
    <source src="intro.mp4" type="video/mp4" id="video">
    Your browser does not support the HTML5 player.
  </video>
</div

Css:

.video-wrapper{
    overflow: hidden
}

.video-wrapper #video{
    position: relative; /* could be absolute if needed */
    left: 1px;
}
like image 44
Yehuda Menahem Avatar answered Sep 24 '22 17:09

Yehuda Menahem