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

Styling images with responsiveness and decorative touches

From: Up and Running with Bootstrap 3

Video: Styling images with responsiveness and decorative touches

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.

Styling images with responsiveness and decorative touches

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.

Show transcript

This video is part of

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

37 video lessons · 23129 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.