【发布时间】:2019-02-12 03:43:06
【问题描述】:
我有一个嵌入的 vimeo 视频,但问题是它没有覆盖可见屏幕的整个宽度。它覆盖了高度。 我已将宽度和高度分别设置为 100vw 和 100vh。
代码如下
<body id="page-top" data-spy="scroll" >
<section id="videoplayersection">
<div id="videoplayer">
<!--
<img alt="" src="../images/b1.jpg" class="img-responsive" id="randomimg">
<h1 id="wedname">A weds B</h1> -->
<div id="playerholder" style="padding:56.25% 0 0 0;position:relative;">
<iframe src="https://player.vimeo.com/video/287060201" style="position:absolute;top:0;left:0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen>
</iframe>
</div>
<script src="https://player.vimeo.com/api/player.js"></script>
<!-- <p>
<a href="https://vimeo.com/287060201">Dolomites - a timelapse adventure</a> from <a href="https://vimeo.com/casperrolsted">Casper Rolsted</a> on <a href="https://vimeo.com">Vimeo</a>.
</p> -->
</div>
div id="story"class="container">
<div class="row">
<div class="col-sm-12">
<div class="story-content ">
<p>
Taj and Atisha, two people from two different countries and two different cultures. Taj, West Indian and Atisha, a Sri Lankan, both brought up in England. They connected with each other through common friends at that time and found themselves to be extremely one with each other. Atisha loves her prosecco, and Taj loves barbecues. Their friends are their family, they do nothing without them. And so, they decided to have a small little destination wedding here in Goa with just their closest of the closest friends and their parents at the beautiful Stone Water Eco Resort.
</p>
</div>
</div>
</div>
</div>
</section>
<!-- <div class="wthree_title_agile">
<p id="heartunderline"><i class="fa fa-heart-o" aria-hidden="true"></i></p>
</div> -->
这里是css部分
.story-content
{
position: relative;
/* padding:0px 220px; */
}
.story-content p
{
font-weight: 500;
font-size: 20px;
display: block;
padding-left: 8%;
padding-right: 8%;
}
#story{
margin-top: 50px;
}
#videodiv {
position: relative;
}
@media (max-width: 1200px) {
.story-content p
{
padding-left:1%;
padding-right:1%;
}
}
@media (min-width: 1200px) {
.story-content p
{
padding-left:8%;
padding-right:8%;
}
}
@media (max-width: 1024px) {
.story-content p
{
font-size: 22px;
}
}
@media (max-width: 800px) {
.story-content p
{
font-size: 20px;
}
}
@media (max-width: 550px) {
.story-content p
{
font-size: 18px;
}
}
@media (min-width: 300px) and (max-width: 400px) {
.story-content p
{
font-size: 25px;
}
}
@media (max-width: 1024px) {
iframe{
/* display: block; */
width: 100%;
height: 100%;
/* object-fit: cover; */
}
}
@media (max-width: 1200px) {
#playerholder{
/* position: absolute; */
width: 100%;
height: 100%;
overflow: hidden;
}
iframe{
display: block;
width: 100vw;
height: 100%;
object-fit: contain;
}
}
@media (min-width: 1201px) {
#playerholder{
width: 100%;
height: 100%;
overflow: hidden;
}
iframe{
display: block;
width: 100vw;
height: 100vh;
object-fit: contain;
}
}
我尝试将 iframe 的宽度更改为 100%;如果我这样做,什么都不会改变。 如果我将 iframe 的高度更改为 100%,宽度更改为 100vh/100%;它增加了它的高度并且不适合可见的屏幕
【问题讨论】:
-
没有覆盖整个宽度,究竟是什么?
-
可见屏幕的宽度
-
我不确定我们是否有足够的信息在这里提出解决方案。使用提供的代码,我看不到您在浏览器中描述的相同问题。显示器本身、它的纵横比等等都可能发挥作用。
-
您能否建议应该添加哪些额外信息?
-
@AmeyBhivshet 是的。它只需要一侧的最大值。
标签: html twitter-bootstrap css iframe vimeo