Viewers: in countries Watching now:
The next thing I'd like to work on here on my website is dealing with these images. One of the things you might have noticed about these images in Bootstrap is that they are actually not responsive. Even though Bootstrap is a responsive design framework, images out of the box with Bootstrap are not responsive. Because as I make my page smaller here, my images are actually staying the same size. In fact, they start to get cut off. That's kind of obvious down here in these four images down towards the bottom of the screen. As I make this smaller and smaller, those images are staying the same size.
In fact I even have a little, a few little wrapping issues here. So, what I'd like to do then is I'd like to make these images responsive, which may be a really wonderful idea. In Bootstrap 3, you actually have to specify that specifically that you want those images to behave in a responsive manner in order for that to happen. So I'll show you how to do that. And the other thing I'd like to do is I'd like to add some nice little image effects to this page. For example, I'd like to do something with the Jumbotron picture here to make it look a little bit nicer. Maybe round a few corners in a couple of places, that kind of thing.
So what I'm going to do is I'm going to take a look at this file inside of Sublime text this is 03_04. Comes from your Exercise Files folder, copy it into the Bootstrap folder open it up here. And what I'm going to do first is I'm going to address these images and make them responsive. So for pretty much every image on the page, I'd like them all to be responsive. So I'm starting here at line 17, which is where my first image occurs. There is an image tag there. Just after that Alt tag, I'm going to add a class of IMG-responsive.
And this class I'm going to add in several places on the page. So I'm just going to copy that. And then I'm going to paste this in. Here on the second image, the animals image, I've already got a class here. So I'm going to go ahead and add img-responsive, and then further down here, in the Jumbotron, I'm going to add it, img-responsive. Then for each of these images down below here in the grid of four images. I'm going to go ahead and add the class of image responsive to each of these images and that's on lines 34, 42, 48 and line 54.
There we go. I think that's all the images that I have here on the page. So go ahead and save that and let's refresh this page. And so you won't see any change immediately while your screen is big, but as you now start to resize the page, hey look at this. Notice how the image sizes are starting to change and that gets really obvious as we get here at the narrow screen sizes. Alright. So that is the behavior that we've been, really been looking for all along. So, that is something that I would recommend that you add pretty much to all of your images, unless you have a darn good reason not to.
The other things that we can add to our images are some decorative kinds of classes. And these are kind of fun. So, for the Jumbotron image here, what I'd like to do is add a class here as well. We already have it floating to the right. That's this pull-right. There's our image responsive. I'd like to add another class, Img-circle. So this is going to actually put rounded corners on all four corners of this image. But they're rounded to such an extent that they wind up making the image look like an oval. So if you go ahead and do that and save it and then refresh your page, there we go there we have a nice little oval.
I think that, that adds a nice touch to that particular picture. So I'm going to go ahead and leave that. To this kitty picture here, I'm going to add another class to that. In fact to the kitty and the fish. So I'm down here on line 42 where I have a class of image-responsive. I'm going to add a class of img-rounded and this is going to make the image have rounded corners. So I'm going to put that here on that kitty cat image. That's line 42. And I'm also going to put it on line 54 here. That's the goldfish image.
And if I save that and I go ahead and refresh the browser. There we go. So now we have some nice little rounded corners there in that image. Also in the goldfish. Rounded corners don't make as much sense on the dog pictures here because it's kind of, got a white background. So those won't be obvious but what we could add to these is a thumbnail treatment. This used to be called the Polaroid in the previous version of Bootstrap. It's now called the Thumbnail in this current version of Bootstrap. So this would be the dog that's on line 48 here. So I can add img-thumbnail. And that's on line 48.
And then up on line 34. Img-thumbnail and so this is going to put a little gray border around those images. And with a white background image on a white background webpage that'll give these images a little bit more definition. So, if I refresh this page There we go. So now these images have got this little line around them. Maybe you like that, maybe you don't. But that's the third kind of treatment that you can add to your images. So just to summarize real quickly, those are classes that you can add to your images.
I recommend you add img-responsive to every image that you put into your Bootstrap website. This will allow your image to scale depending on the screen size. Then you have three decorative classes that you can add. Img-circle will give you a round image. Img-rounded will give you rounded corners on your image. Or Img-thumbnail will give you this nice little gray border around your image.
Find answers to the most frequently asked questions about Up and Running with Bootstrap 3 .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
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.