Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Exploring Bootstrap's responsive classes including .hidden and .visible

From: Up and Running with Bootstrap 3

Video: Exploring Bootstrap's responsive classes including .hidden and .visible

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.

Exploring Bootstrap's responsive classes including .hidden and .visible

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.

And if you have a bunch of these kinds of images on your page and you're just hiding things as you get down to smaller and smaller screen sizes, what you're going to do is. You're still going to be downloading all these pictures to the phone, even though they aren't displaying on the page. And when a phone is running over a network, particularly a slow network, that is going to make your page download time very small so you could wind up still with a very beefy webpage with all of these images that you're hiding. There's better ways of dealing with images in Responsive design. There's JavaScript tricks you can use, there's server side techniques you can use, they're all beyond the scope of this course but treatment into images is something that you should look into and I kind of feel what I want to show you now is a little bit of a hack to hide this picture at smaller dimensions.

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.

Show transcript

This video is part of

Image for Up and Running with Bootstrap 3
Up and Running with Bootstrap 3

37 video lessons · 23138 viewers

Jen Kramer
Author

 
Expand all | Collapse all
  1. 5m 25s
    1. Welcome
      58s
    2. Using the exercise files
      1m 19s
    3. Installing Sublime Text 2
      3m 8s
  2. 29m 0s
    1. What is Bootstrap?
      8m 1s
    2. Downloading and unzipping Bootstrap 3
      4m 31s
    3. Examining Bootstrap file structure
      4m 34s
    4. Adding CSS to a Bootstrap HTML file
      4m 35s
    5. Adding JavaScript to a Bootstrap HTML file
      7m 19s
  3. 44m 38s
    1. Exploring Bootstrap's grid system
      9m 10s
    2. Creating new rows and cells
      14m 5s
    3. Adjusting column widths using offset
      5m 2s
    4. Changing column order using push and pull
      5m 34s
    5. Nesting columns
      3m 43s
    6. Creating a JumboTron-style layout
      3m 41s
    7. Challenge: Working with grids
      1m 31s
    8. Solution: Working with grids
      1m 52s
  4. 53m 34s
    1. Exploring basic typography: The small and blockquote tags
      4m 29s
    2. Exploring Bootstrap's responsive classes including .hidden and .visible
      4m 44s
    3. Styling buttons using btn classes
      4m 43s
    4. Styling images with responsiveness and decorative touches
      5m 22s
    5. Incorporating Bootstrap 3 glyph icons
      3m 28s
    6. Creating a thumbnail gallery
      6m 2s
    7. Styling tabular data
      5m 3s
    8. Overriding core CSS with custom styles
      12m 53s
    9. Challenge: Styling panels and callouts
      2m 17s
    10. Solution: Styling panels and callouts
      4m 33s
  5. 27m 41s
    1. Implementing location breadcrumbs
      6m 38s
    2. Using tabs and pills for navigation
      6m 58s
    3. Developing a responsive navigation bar
      9m 9s
    4. Challenge: Modify the "pancake" button
      1m 3s
    5. Solution: Modify the "pancake" button
      3m 53s
  6. 37m 45s
    1. Implementing dropdowns within a navigation bar
      5m 5s
    2. Tabbing within the same page
      15m 45s
    3. Accordion panels with collapse functionality
      11m 37s
    4. Challenge: Tooltips
      1m 59s
    5. Solution: Tooltips
      3m 19s
  7. 3m 0s
    1. Next steps towards advanced Bootstrap
      3m 0s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Up and Running with Bootstrap 3.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.