How to use video as a text background using HTML & CSS only?

 


How to use video as a text background using html & CSS? | HTML & CSS for beginners tutorial.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Video Background</title>
    <style>
        *{
            margin: 0;
            padding: 0;

        }
        .banner{
            position: absolute;
            width: 100%;
            height: 100vh;
            overflow: hidden;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .banner video{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;

        }
        .banner h2{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #fff;
            font-size: 30vh;
            text-align: center;
            text-transform: uppercase;
            color: #000;
            line-height:100vh ;
            mix-blend-mode: screen;
        }
    </style>
</head>
<body>
    <div class="banner">
        <video autoplay muted loop>
            <source src="Nepal.mkv" type="video/mp4">
        </video>
        <h2>Video</h2>
    </div>
</body>
</html>


1 Comments

  1. Really Nice Post. Great Information. I got lots of stuffs useful here. Just go through our best services we are offering here. We provide Online Bookkeeping Services ,
    bookkeeping services in Baltimore , bookkeeping services in Chicago bookkeeping services in Philadelphia at affordable prices.

    ReplyDelete
Previous Post Next Post