Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
It's relatively easy to create responsive text elements on a web page. Text, after all, is designed to reorganize and flow depending on the size of the box that contains it. Images and video are different matter entirely. Images by their very nature have a fixed height and width, and we have to deal with that in a nondestructive and functional manner. And when it comes to videos, it's a total gong show because there's so many standards out there and more often than not, we are pulling the videos from external sources like YouTube and Vimeo, and those sources put restrictions on us.
But fret not, my friend. All can be solved with code. We just have to decide what the end result should look like first. Let's take a look at the images on this page. Before we dive into the code itself, I just want to give you an idea of what we're talking about when we are talking about responsive images and responsive video. If you look at this page, we have fixed widths for these images. If I change the size of my window, you will see that the image stays the same size no matter what I do.
However, if I open this post in a single post and then again resize the window, you will see that the image will resize with the window. In certain sizes, you'll even see this image resize dynamically, like this. This is a built-in function in your browser where the browser automatically will realign the image and crunch the pixels to make everything work, but it's a function that you have to activate through the use of CSS.
If you don't do it, you will end up with an image that stays the same size and as you resize your window, the image gets cropped closer and closer and closer and closer. I am sure you have seen this, both on your cell phone and also on web sites time and again, because it's fairly common. But in this course, we are going to look at how to work around it. There is one more important thing you need to remember. When you upload an image to WordPress, what WordPress does is it creates multiple different versions of that image in different sizes.
As a result, the image we are looking at here is 620 x 375 pixels; however, if we go and look at the image on the front page, you see it's 298 x 180 pixels. This is important, because when you're loading the front page and you know that the image is going to be a fixed width and it's going to be small, you don't want to load up a huge image and then crunch it down to fit that small space. You want to load the image that's exactly the size you are for and in an ideal world, there would be a standard for this so that it would be easy to do and you could serve properly responsive images.
Unfortunately, we're not at that point yet, because the browser manufacturers are still arguing over what is the best approach. So in the meantime, we have to handle those images ourselves and decide whether we want to take a large image and scale it down or if we just want to use small images. Like I said in the intro, compared to videos, images are easy. Videos are a whole different ball of wax, and in this course, you will learn how to make properly responsive videos, because when a video comes from YouTube or Vimeo or anywhere else, it's not responsive, which means if you resize the window, the video will stay the same size.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.