Web Development Kodex

embedded youtube video

index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Embedded Youtube Video</title>
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Embedded Media</h1>
</header>
<div class="wrapper">
<div class="container">
<h2>Embedded Youtube Video</h2>
<div class="video-container">
<div class="video">
<iframe src="http://www.youtube.com/embed/e7549MvSiAQ" frameborder="0" allowfullscreen=""></iframe>
</div>
<!-- .video -->
</div>
<!-- .video-container -->
</div>
<!-- .container -->
</div>
<!-- .wrapper -->
<footer>
<small><a href="https://opensource.org/licenses/MIT">MIT</a></small>
</footer>
</body>
</html>

styles.css

body {
background: #eeeeee;
font-size: 16px;
font-family: "Trebuchet MS", Helvetica, sans-serif;
margin: 0;
}
a {
color: crimson;
text-decoration: none;
}
a:hover {
color: red;
}
/* Layout
------------------------------------------*/
header,
.container,
footer {
margin: 0 auto;
width: 88%;
max-width: 1080px;
}
.wrapper {
padding: 1em 0;
background: #fff;
}
/* Video
------------------------------------------*/
.video-container {
max-width: 600px;
}
.video {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video iframe,
.video object,
.video embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}