In this tutorial how I applied responsive view for youtube video using the bootstrap. Here I used bootstrap 3.3.7 css library. I will maintain the aspect size of the youtube video for desktop, mobile or tablet views.
Piece of code for youtube video responsive:
<div class="embed-responsiveembed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/ImFG7baf0Qk"></iframe>
</div>
Responsive youtube embed bootstrap
You just replace the youtube id from the above code with yours.
HTML CODE with references for responsive view:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<h2>Fixed Embed</h2>
<div class="row">
<div class="col-md-6">
<iframe width="700" height="450" src="https://www.youtube.com/embed/ImFG7baf0Qk" frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
</div>
<h2>Responsive Embed</h2>
<div class="row">
<div class="col-md-6">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/ImFG7baf0Qk"></iframe>
</div>
</div>
</div>
<p>Creates a responsive video and scale it nicely to mobile view.</p>
<div class="clearfix" >
</div>
</div>
</body>
</html>
VIDEO GUIDE:
Post your comments / questions
Recent Article
- How to fix HAXM is not installed |in Android Studio
- How to fix CMOS Checksum Error in Computer or Laptop | SOLVED
- Reactivating windows after a Hardware change on PC or Laptop
- FIXED: Windows reported that the hardware of your device has changed. Error code :0xc004F211
- "redirect" is not defined pylance("reportUndefinedVariable)
- This action cannot be completed because the file is open in SQL Server(SQLEXPRESS) - FIXED
- Unicode error 'unicodeescape' codec can't decode bytes in position 2-3: truncated UXXXXXXXX escape
- Could not find the 'angular-devkit/build-angular:dev-server' builder's node package | Angular Error
Related Article