【问题标题】:Use video script as div background [ HTML / CSS ] [duplicate]使用视频脚本作为 div 背景 [ HTML / CSS ] [重复]
【发布时间】:2023-03-14 07:51:01
【问题描述】:

如果我的曲子不好,请见谅。 我有这段html代码

HTML:

<div class="video_bg"> ---- Some Code to execute ---</div>

CSS:

.video_bg{
  width:600px;
  height:600px;
  float:left;
  }

并有一个视频嵌入代码

<iframe src="//player.vimeo.com/video/71906867" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

问题: 我可以通过使用任何脚本或 css 将此视频用作 div "video_bg" 的背景吗?

【问题讨论】:

    标签: css html video background


    【解决方案1】:

    您可以轻松使用 jquery.videobackground 插件。

    在这里阅读:http://georgepaterson.github.io/jquery-videobackground/

    【讨论】:

    • 如果用户完全调整浏览器的大小,这会变得非常混乱。
    【解决方案2】:

    你的意思是你想在背景视频上放置一些文字图片等?
    如果你的意思是这样的,你可以通过定位你的 div 来做到这一点。
    像这样:

    <div class="video_bg"><iframe src="//player.vimeo.com/video/71906867" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe><p class="text">Some text goes here</p></div>
    .video_bg iframe{
    width: 500px;
    height:281px;
    position: relative;
    }
    .text {
    position:absolute;
    font-size: 20px;
    text-align:center;
    }
    

    【讨论】:

    • 我的意思是将视频作为背景图像。使用视频而不是图像作为背景
    猜你喜欢
    • 2014-01-16
    • 1970-01-01
    • 2021-08-17
    • 1970-01-01
    • 2012-06-12
    • 1970-01-01
    • 2011-04-17
    • 1970-01-01
    • 2018-09-26
    相关资源
    最近更新 更多