javascript contador Saltar al contenido

To add YouTube videos to your site that automatically adapt their size

embed

Posting a YouTube video on a website (be it blog, portal, corporate site or any other means) is as simple as copying and pasting the code shown in the existing Share part in the lower section of each one. We can choose the size of it to adapt to the design of our site, but … what happens when we are consulted from a mobile phone? or from a giant monitor ?.

webdesignerwall.com comments on a solution, a solution we saw later on seetio.com. It is a solution that we can use by altering the style sheet (.css) of our blog, something as simple as adding the following lines:

Once this is done, we can include the video, with the size that we want, using the class that we indicate:

Of course, the class name (.video-container) can have whatever name you want, as that does not affect the result.

They developed this solution during the programming of the WordPress theme Elemin, one of the many themes that are sold in themify.me. Themify is well known for two topics that got a lot of attention relatively recently: one that is reminiscent of Windows 8 and another that is reminiscent of the Facebook timeline; two quite attractive themes, although they are little implemented on the web (there is not so much brave in this world).