【问题标题】:How do I add text on a video like PayPal's?如何在 PayPal 之类的视频上添加文字?
【发布时间】:2014-08-11 23:07:03
【问题描述】:

在 PayPal 中,他们在视频顶部带有标语“您成功,我们会付款”,并且在角落附近有一个小播放按钮。当您单击此播放按钮时,视频将开始播放,导致曾经在视频未播放时将视频分层的深色叠加层平滑地消失,而标语仍然存在。这是怎么做到的?你能提供例子吗,我认为效果很整洁。

谢谢!

【问题讨论】:

    标签: javascript html css video paypal


    【解决方案1】:

    Demo

    以下示例显示来自 <video> 标记的全屏视频,仅使用 css 显示全屏内容,并使用 position: absolute 在图像上进一步显示所需文本

    css

    .videoInsert {
        position: absolute; 
        right: 0; 
        bottom: 0;
        min-width: 100%; 
        min-height: 100%;
        width: auto; 
        height: auto; 
        z-index: -100;
        background-size: cover;
        overflow: hidden;
    }
    h2 span { 
       color: white; 
       font: bold 24px/45px Helvetica, Sans-Serif; 
       letter-spacing: -1px;  
       background: rgb(0, 0, 0); /* fallback color */
       background: rgba(0, 0, 0, 0.7);
       padding: 10px;
        z-index: 999999999999;
        position: absolute;
        margin:auto;
        left:0;
        right:0;
        top:0;
        bottom:0;
        height: 100px;
        width: 80%;
        text-align: center;
    }
    

    html

    <div class="wrapper">
        <video class="videoInsert">
            <source src="http://www.w3schools.com/html/movie.mp4" type="video/mp4">
            <source src="movie.ogg" type="video/ogg">Your browser does not support the video tag.
        </video>
    </div>
    <h2><span>A nice office video:<br />Yes it is!</span></h2>
    

    【讨论】:

      猜你喜欢
      • 2012-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-17
      • 1970-01-01
      • 2012-05-12
      • 1970-01-01
      相关资源
      最近更新 更多