videoタグで背景いっぱいに動画を表示
html
<html>
<head>
<meta charset="utf-8">
<title>無題ドキュメント</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<video id="bgvid" autoplay loop muted>
<source src="video.mp4" type="video/mp4">
</video>
<div id="container">
<div class = "overlay">
<h1>動画を背景にする</h1>
<p><ruby>薔薇<rt>ばら</rt></ruby></p>
<p>サンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストですサンプルテキストです
</p>
</div>
</div>
</body>
</html>
@charset "UTF-8";
html, body, div, h1, h2, h3, h4, h5, h6,p, blockquote, pre,
address,ul, ol, li, dl, dt, dd,table, th, td, form, fieldset {
margin: 0;
padding: 0;
line-height: 1.0;
font-family:
"ヒラギノ明朝 ProN",
"HG明朝E",
"MS P明朝",
"MS 明朝",
serif;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
ul, ol {
list-style: none;
}
a {
text-decoration: none;
}
img {
border: 0;
}
img, input {
vertical-align: bottom;
}
video#bgvid{
position:fixed;
left: 0;
top: 0;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
background:url(XXXX.jpg) no-repeat;
background-size: cover;
display: block;
}
#container{
width: 100%;
height: auto;
background:rgba(231, 76, 60, 0.6);
}
.overlay{
background: rgba(0,0,0,0.4);
color: #FFF;
margin: 40px;
padding: 20px 20px 50% 20px;
width: 40%;
border-radius: 10px;
float: left;
}
.overlay h1{
font-size: 3em;
margin-bottom:20px;
}
.overlay p{
line-height: 1.5;
}