How To Make Your Embedded Video’s Responsive

Here’s 6 different ways you can make your embedded video’s responsive so they automatically resize in different sized browsers for mobile devices.

You can use CSS code, Javascript or install one of several plugins.

CSS Code

This code will make your videos flexible so they change size when viewed in different size browers.

You’ll need to add the CSS code to your style.css file and the HTML opening and clsoing div tags before and after your video embed code or Youtube iframe.

Demo

Add this code to the end of your child themes style.css file.

Then wrap your embed code in div tags with the same class you use in your style.css file.

This method didn’t always work for me in all browsers.

Source: Creating Intrinsic Ratios for Video

Using Javascript

  1. Firstly, download the 2 javascript files (fluidvids.js & fluidvids.min.js) from fluid vids from Github.
  2. Create a new folder in your child theme named lib
  3. Upload the 2 javascript files to your child themes lib folder. child/lib/js
  4. Add this PHP code at the end of your child themes functions.php file.

All you need to do now is paste your video url on its own line using the WordPress text editor and you’re video will now resize in all browsers.

Responsive Video Embed Plugins

Here’s 4 good plugins which also make all the videos on your website responsive.

Thanks to Anita & the SP community forums users for this great tip.

3 responses to “How To Make Your Embedded Video’s Responsive”

  1. Hi Brad,

    I have tested on my site but seem not working. Would you mind to check for me if I’m missing anything?

    Regards,
    Joseph

  2. Hi Brad,
    I have to say you release great tutorial! But for me as a total beginner I´m confused with all these codes and where exactly to insert it in Genesis/Dynamik.
    I´m happy you mentioned also some plugins which are much easier to use but as I understand so far to much plugins is not good.
    thanks again
    Vit

    1. Brad Dalton Avatar
      Brad Dalton

      Thanks Vit

      Generally PHP code goes at the end of your child themes functions.php file unless its for a template.

      CSS code normally goes at the end of your child themes style.css file.

      Dynamic includes a custom CSS and PHP field for custom code which is a bit different.

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.