Created
July 15, 2017 01:57
-
-
Save manbearwolf/71b95a7c29d90779f8fff62957b830ba to your computer and use it in GitHub Desktop.
Center the Hell! Out of YouTube Embedded Videos (Put it in Main.css)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Centers the hell | |
out of Embeded Videos | |
*/ | |
.video-container { | |
position:relative; | |
padding-bottom:56.25%; | |
padding-top:30px; | |
height:0; | |
overflow:hidden; | |
width:100%; | |
} | |
.video-container iframe, .video-container object, .video-container embed { | |
position:absolute; | |
top:0; | |
left:0; | |
right:0; | |
bottom:0; | |
margin: auto; | |
width:100%; | |
height:100%; | |
} | |
Example in HTML: | |
<div class="video-container"> | |
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/bUqy0jlqmAU/0.jpg" frameborder="0" src="https://www.youtube.com/embed/bUqy0jlqmAU?feature=player_embedded"></iframe> | |
</div> |
padding-top:0px;
on blog theme.
theme already centers... (as well)! Bottom is maybe all you need.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sometimes video...
.video-container {
width:100%;
}
line isn't needed.