embedded [youtube] videos not responsive
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat May 21, 2022 4:58 pm
embedded [youtube] videos not responsive
I have embedded (iframe) a [youtube] video on a Joomla 4 website. It works great on a PC, but on a mobile phone it is not responsive (the video is wider that the mobile screen). On my joomla 3 websites my embedded [youtube] videos are responsive. How do I make [youtube] videos responsive on a joomla 4 website. I think I have to use css, but don’t know what lines to use.
- Per Yngve Berg
- Joomla! Master
- Posts: 30923
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat May 21, 2022 4:58 pm
Re: embedded [[[youtube]]] videos not responsive
Thanks for the suggestion. However, I am trying to avoid extra extensions. In Joomla 3 it worked fine without an extension, so am looking for a way to get it to work in Joomla 4 without one.
- Per Yngve Berg
- Joomla! Master
- Posts: 30923
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
Re: embedded [[[youtube]]] videos not responsive
Using an iframe is a bas idea. At least use a video tag.
https://www.w3schools.com/tags/tag_video.asp
https://www.w3schools.com/tags/tag_video.asp
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat May 21, 2022 4:58 pm
Re: embedded [[[youtube]]] videos not responsive
I didn’t know about the video tag option (interesting). I used your link and also did some googling to understand the pros and cons of the HTML5 video tag vs iframe. For my requirements I think the iframe is the better options. The reason for my original question is because I saw a YT video by ‘Learn Joomla 4’ (Brian Teeman) titled Power Tips Embed [youtube] videos. In the comments he said we can get iframe embedded videos to be responsive by using css, but he did not say how.
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat May 21, 2022 4:58 pm
Re: embedded [[youtube]] videos not responsive
I found a way to do this. This video is what I used https://www.[youtube].com/watch?v=0L8cQ9nRtuE It was a bit complicated and you need to know how to create and edit a user.css file and then you have to add code in the article (Toggle editor) which is the html code. Bit complicated but it works.
Also found the below useful (but above [youtube] video is all you need).
https://www.[youtube].com/watch?v=9YffrCViTVk
https://www.[youtube].com/watch?v=ul3mcXMX0gA
https://www.w3schools.com/howto/howto_c ... frames.asp
https://www.benmarshall.me/responsive-iframes/
https://usefulangle.com/post/142/css-video-aspect-ratio
https://www.w3docs.com/snippets/css/how ... h-css.html
Also found the below useful (but above [youtube] video is all you need).
https://www.[youtube].com/watch?v=9YffrCViTVk
https://www.[youtube].com/watch?v=ul3mcXMX0gA
https://www.w3schools.com/howto/howto_c ... frames.asp
https://www.benmarshall.me/responsive-iframes/
https://usefulangle.com/post/142/css-video-aspect-ratio
https://www.w3docs.com/snippets/css/how ... h-css.html
- AMurray
- Joomla! Exemplar
- Posts: 9732
- Joined: Sat Feb 13, 2010 7:35 am
- Location: Australia
Re: embedded [[[youtube]]] videos not responsive
To me, it would have been easier just to use the plugin @Per mentioned.
The other way, is to use You-Tubes 'embed' code. You can find that on every video.
The other way, is to use You-Tubes 'embed' code. You can find that on every video.
Regards - A Murray
General Support Moderator
General Support Moderator
- brian
- Joomla! Master
- Posts: 12787
- Joined: Fri Aug 12, 2005 7:19 am
- Location: Leeds, UK
- Contact:
Re: embedded [[[[youtube]]]] videos not responsive
The embed code is an iframe
For the css I referred to check out the output of https://embedresponsively.com/
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat May 21, 2022 4:58 pm
Re: embedded [[[youtube]]] videos not responsive
Marian gave me this solution. Works well. Nothing else needed.
on user.css add these lines:
@media (max-width: 575.98px) {
iframe{
width:100%;
height:100%;
}
}
on user.css add these lines:
@media (max-width: 575.98px) {
iframe{
width:100%;
height:100%;
}
}