dev-resources.site
for different kinds of informations.
Adding Responsive Design to embedded YouTube videos with TailwindCSS
Published at
4/2/2022
Categories
tailwindcss
nextjs
Author
Manuel Alfรฉrez Ruiz
YouTube does not offer a way to automatically resize and scale. Here is a list of steps to achieve this with Tailwind:
1- Install the plugin @tailwindcss/aspect-ratio
npm i @tailwindcss/aspect-ratio
2- Add the installed plugin to the Tailwind settings
// tailwind.config.js
plugins: [require("@tailwindcss/aspect-ratio")],
3- Add Responsive Design to your videos:
<div class="aspect-w-16 aspect-h-9">
<iframe src="https://youtu.be/NX_NW6bt6_s" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
References
- Sizing Images and Videos with Aspect Ratios with Tailwind CSS (Link to YouTube)
- @tailwindcss/aspect-ratio (Link to npm)
Articles
5 articles in total
WRONGTYPE Operation against a key holding the wrong kind of value
read article
Custom fonts in Fresh + Twind
read article
ChatGPT-Powered Finance App
read article
Adding Responsive Design to embedded YouTube videos with TailwindCSS
currently reading
Custom fonts in Next.js + Tailwindcss
read article
Featured ones: