Viewers: in countries Watching now:
So I'm taking a look at my services page again, this is from HTML file 03_02 in your exercise files folder. Copy it on into your Bootstrap folder. Open it up in your browser, and you should see something like this. This is a page that we built in the previous chapter working on the grid system. And one of the things that's been bugging me about this page, maybe it's been bugging you, too. It looks great while it's big like this. As I start to make the page smaller, it's still looking good. I like the way these are stacking down here on the bottom, but when we get to this break point here, right here, there we go, these animals that look so great on the larger screen dimensions, wrap underneath the logo here.
And it just kind of looks silly to me. It's not really adding anything to the page at this point, particularly as this gets even narrower. That animal picture really isn't adding a lot to the site. It's just pushing content down the page. Although it serves a great purpose here at the larger dimensions. Where we have this image up here in the upper right corner. So what I'd like to do is, I'd like to find way to get rid of that image where we're at smaller dimensions. So I'm going to show you how to do this using Bootstrap's visibility and responsive utility classes. Before I do that, let me just give you a little bit of background about something to consider.
The classes that I am about to show you are tied to media queries and they're designed to show or hide elements depending on the width of the screen. So they are frequently used for the kind of trick that I am going to show you here, which is. Give me this image and show it over here on the right when my screen is particularly wide and get rid of it when the screen is smaller, something like that. Be aware that even though I am going to use a class that effectively has a CSS display of none associated with it. That image of these animals is still going to download on a mobile phone, which will still increase the size of the page overall.
But these are classes that are available in Bootstrap, so I'm going to show you how they work. Just be careful not to use them for evil. Anyway, here we are. This is our HTML page. And we are going to scroll on down here to line number 20. And so this is the call to that particular little decorative image. We don't even have an ALT tag for this. It's just a decorative image on the page to make it look pretty. So right now, this is going to show at any of the screen dimensions. But if you take a look at Bootstrap's documentation here, this is under getbootstrap.com.
Click on CSS, and then click on Responsive Utilities further down on the page, here. These are a whole series of classes that are tied to the media queries inside of Bootstrap, so there are a series of these classes that are for an element being visible at certain dimensions, corresponding to grid sizes, extra small, small, medium, and large, and there are dimensions here to hide elements at certain dimensions. So what I really like to have happen is, at less than 768 pixels, which is where that animal starts to wrap, I'd like to hide it completely.
So the class that I need to use here is dot hidden dash xs. So, hide those at extra small dimensions. Just remember it's still going to download, but it will not display on the web page. So, I am going to go ahead and add that here, inside of line 20, we are going to add a class of hidden hyphen xs. And if you go ahead and save that and then, refresh your page here in your browser. There we go. There's our animals sit there, a fairly broad dimension here, probably around 1300 pixels. As we start to get narrower, you'll see that the screen is adapting.
Things are looking good until we hit this break point, there, and now that image is just gone entirely. So, I think that this works better for the mobile dimensions. It's definitely a little bit of open white space here, but I don't think it looks really terribly bad at this particular dimension, and as we get even narrower here. It definitely looks a lot better at these narrower dimensions not to have that animal picture pushing the content down on the page. So there's several of those responsive classes inside of Bootstrap, and I would encourage you to take a look at these and explore them for use in your website.
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.