【问题标题】:Make text under this fullscreen video在此全屏视频下制作文字
【发布时间】:2018-06-14 20:23:36
【问题描述】:
有人可以帮助我吗?我正在为学校制作一个项目,我有一个很酷的想法,将这个全屏视频制作为一种主页/欢迎页面,当他们向下滚动时,他们会看到正常的文本和其他内容。
谢谢
#myVideo {
position: fixed;
min-width: 100%;
min-height: 100%;
}
.content {
text-align: center;
font-size: 500%;
width: 100%;
padding: 20px;
color: #FFF;
font-family: 'ds';
mix-blend-mode: difference;
filter: drop-shadow(.05em .05em orange);
}
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<div><video autoplay muted loop id="myVideo">
<source src="xxx.mp4" type="video/mp4">
</video>
<div class="content">
<p>$WHY ISNT THIS WORKING$</p><br>
<p>$CZP$</p>
</div></div>
<h1>This text needs to be under the video</h1>
【问题讨论】:
标签:
html
css
html5-video
fullscreen
【解决方案1】:
这是你要找的吗?
#myVideo {
width: 100vw;
height: 100vh;
}
.video-container {
min-width: 100vw;
min-height: 100vh;
background-color: green;
}
.content {
background-color: yellow;
text-align: center;
font-size: 500%;
width: 100%;
padding: 20px;
color: #FFF;
font-family: 'ds';
mix-blend-mode: difference;
filter: drop-shadow(.05em .05em orange);
}
<div class="video-container">
<video autoplay muted loop id="myVideo">
<source src="xxx.mp4" type="video/mp4">
</video>
</div>
<div class="content">
<p>$WHY ISNT THIS WORKING$</p><br>
<p>$CZP$</p>
<h1>This text needs to be under the video</h1>
</div>
【解决方案2】:
只需将position: relative; 用于#myVideo
因为你用过fixed
#myVideo {
position: relative;
min-width: 100%;
min-height: 100%;
}
.content {
text-align: center;
font-size: 500%;
width: 100%;
padding: 20px;
color: #FFF;
font-family: 'ds';
mix-blend-mode: difference;
filter: drop-shadow(.05em .05em orange);
}
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<div>
<video autoplay muted loop id="myVideo">
<source src="https://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4" type="video/mp4">
</video>
<div class="content">
<p>$WHY ISNT THIS WORKING$</p><br>
<p>$CZP$</p>
</div></div>
<h1>This text needs to be under the video</h1>