简体   繁体   English

视频播放器显示黑色边框

[英]Video player shows black border

I use a HTML5 video player and it works, but it shows a 1/2 pixel border on the right side.我使用 HTML5 视频播放器,它可以工作,但它在右侧显示 1/2 像素的边框。 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结果是

在此处输入图片说明

If someone could help me out, I would be really happy :D如果有人可以帮助我,我会很高兴:D

Thanks谢谢

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. // 或者,如果您需要关注 ADA/WCAG 合规性,请选择颜色或透明或其他颜色。

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.修复隐藏它有点解决它 - >给父元素,谁包装视频溢出:隐藏和视频(相对位置/绝对位置)左: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: css:

.video-wrapper{
    overflow: hidden
}

.video-wrapper #video{
    position: relative; /* could be absolute if needed */
    left: 1px;
}

From this (black video borders):从这里(黑色视频边框):

在此处输入图片说明

To This (no black borders): To This(无黑边):

在此处输入图片说明

By adding:通过添加:

<video width="103%" style="margin-left: -3px">

How about:怎么样:

border: none !important;

If this doesn't work try adding as well:如果这不起作用,请尝试添加:

border-right: none !important;

If these don't help please show us your site如果这些没有帮助,请向我们展示您的网站

I found the following to be the best solution for removing the 1px border:我发现以下是删除 1px 边框的最佳解决方案:

video {
    clip-path: inset(1px 1px);
}

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

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