【发布时间】:2018-09-13 13:54:29
【问题描述】:
<link href="https://www1.chester.ac.uk/sites/all/themes/global/css/app_chester.css" rel="stylesheet"/>
<div style="background: #eaeaea">
<div class="column row">
<div class="m-modal-video__column m-modal-video__column--primary">
<div class="m-modal-video m-modal-video--primary-full-width">
<div class="m-cta__vcenter"><h3 style="color: black; text-align: center;">Be Part of It</h3>
<p style="color: black; text-align: center;">Choose an innovative degree that has been designed with your employability at its core.</p>
</div>
</div>
</div>
<div class="m-modal-video__column m-modal-video__column--secondary">
<div class="m-modal-video m-modal-video--primary-full-width">
<div class="m-cta__vcenter">
<div class="m-modal-video__container m-modal-video__container--cinemascope" data-open="youtubemodal">
<a><img src="http://img.youtube.com/vi/Ily454tCpWE/maxresdefault.jpg">
<div class="m-modal-video__overlay m-modal-video__overlay--triangle">
<div class="m-modal-video m-modal-video__triangle"></div>
</div></a>
</div>
<div class="reveal large" id="youtubemodal" data-reveal data-reset-on-close="true">
<div class="m-video m-video--modal m-video--cinemascope"><iframe src="https://www.youtube.com/embed/Ily454tCpWE" frameborder="0" allowfullscreen=""></iframe></div>
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
我的网站上有一个模式,并使用以下内容显示缩略图:
http://img.youtube.com/vi/DxwrdB7A6-I/maxresdefault.jpg
问题是视频的宽高比为 21:9。我使用了以下样式,但仍然在图像的顶部和底部获得黑色信箱。有没有办法只显示没有黑色信箱的 YouTube 缩略图?
&__container {
position: relative;
height: 0;
padding-bottom: 42.85714%;
overflow: hidden;
margin-bottom: 1rem;
a img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
【问题讨论】:
-
你能在这里用一个可运行的代码sn-p重现这个问题吗?看起来 YouTube 为您的视频制作了一个 16:9 的裁剪缩略图,并且您正在拉伸它以适合 21:9 的容器,所以我不确定信箱的来源。如果您让我们看到实际存在的问题,我们可以解决它。
-
我不确定我是否有足够的积分/经验(不管它叫什么)来发布代码 sn-p。只是使用codepen或类似的东西吗?
-
图片图标右侧的编辑工具栏上的按钮。我认为使用该功能不需要任何类型的要求。
-
我已经添加了代码 sn-p。