Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何用HTML5 CSS视频替换Div背景_Css_Html_Video - Fatal编程技术网

如何用HTML5 CSS视频替换Div背景

如何用HTML5 CSS视频替换Div背景,css,html,video,Css,Html,Video,目前有一个拥有自己背景的div,正在努力使用CSS将背景设置为视频 当前设置如下所示: DIV的CSS: .intro-header { padding-top: 50px; /* If you're making other pages, make sure there is 50px of padding to make sure the navbar doesn't overlap content! */ padding-bottom: 50px; text-align: center;

目前有一个拥有自己背景的div,正在努力使用CSS将背景设置为视频

当前设置如下所示:

DIV的CSS:

.intro-header {
padding-top: 50px; /* If you're making other pages, make sure there is 50px of padding to make sure the navbar doesn't overlap content! */
padding-bottom: 50px;
text-align: center;
color: rgb(255, 255, 255);
background: url(../img/intro-bg.jpg) no-repeat center center;
background-size: cover;}
    <div class="intro-header">

    <div class="container">

        <div class="row">
            <div class="col-lg-12">
                <div class="intro-message">
                    <h2>Welcome To Little Mountain Media</h1>
                    <h1>WE BELIEVE IN THE POWER OF VISUAL MEDIA</h3>
                    <hr class="intro-divider">
                </div>
            </div>
        </div>

    </div>
</div>
DIV的HTML:

.intro-header {
padding-top: 50px; /* If you're making other pages, make sure there is 50px of padding to make sure the navbar doesn't overlap content! */
padding-bottom: 50px;
text-align: center;
color: rgb(255, 255, 255);
background: url(../img/intro-bg.jpg) no-repeat center center;
background-size: cover;}
    <div class="intro-header">

    <div class="container">

        <div class="row">
            <div class="col-lg-12">
                <div class="intro-message">
                    <h2>Welcome To Little Mountain Media</h1>
                    <h1>WE BELIEVE IN THE POWER OF VISUAL MEDIA</h3>
                    <hr class="intro-divider">
                </div>
            </div>
        </div>

    </div>
</div>

欢迎来到小山传媒
我们相信视觉媒体的力量

正如您所看到的,非常简单,只需要一个视频来代替into-bg.jpg


谢谢

有很多方法。一个是使用。jQuery是一个JavaScript框架,它包含许多有用的函数,可以使JavaScript开发更快、更容易

  • 从下载jQuery并将其包含到HTML代码中:

    <script src="jquery-2.1.3.min.js"></script>
    

  • 可能重复的问题:有没有关于如何使用上述代码实现的想法,我在努力做什么>@Guillermo