Cara Embed Video Youtube Pada Responsive Design
- Categories:
- css
Secara default, fitur embed dari Youtube tidak mendukung responsive design.
Hal tersebut membuat saya kesulitan karena situs saya sebagian besar mendukung responsive design.
Untuk membuat video embed dari Youtube dapat tampil dengan baik pada situs yang mendukung responsive design seperti blog ini, bisa menggunakan HTML dan CSS berikut.
<!-- HTML -->
<div class="video-wrapper">
<iframe src="https://www.youtube-nocookie.com/embed/4PSh7xqnvRw?rel=0&showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
// CSS
.video-wrapper {
float: none;
clear: both;
width: 100%;
position: relative;
padding-bottom: 56.25%;
padding-top: 25px;
height: 0;
margin-bottom: 30px;
}
.video-wrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
Hasilnya dapat dilihat seperti berikut.
- Tags:
- #css
- #youtube
- #responsive
Recent Posts
AWS Secrets Manager
Explanation about AWS Secrets Manager with example code.
Envelope Encryption
Envelope encryption is the practice of encrypting plaintext data with a data key, and then encrypting the data key under another key.
Tutorial - "su username vs su - username" - A Security Perspective
The main difference between `su username` and `su - username` lies in the environment variables that are loaded when switching to the specified user.
Subdomain Hijacking
My dormant subdomain was recently hijacked, redirecting it to a online gamble registration page.
C# DbContext ServiceLifeTime
my note about C Sharp ServiceLifeTime