Created
August 14, 2016 15:44
-
-
Save bpb54321/6551be7b8b884e1397cf69ed92596a22 to your computer and use it in GitHub Desktop.
Youtube video embed preserves aspect ratio across all screen sizes.
This file contains hidden or 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
| .youtube-video-wrap { | |
| width: 100%; | |
| max-width: 640px; | |
| margin: 3rem auto; | |
| } | |
| .video-container { | |
| position: relative; | |
| padding-bottom: 56.25%; //16:9 aspect ratio, 9/16 = .5625. Padding is percentage of container width | |
| height: 0; | |
| overflow: hidden; | |
| iframe { | |
| position:absolute; | |
| top:0; | |
| left:0; | |
| width:100%; | |
| height:100%; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment