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

Using list groups

From: Bootstrap 3: New Features and Migration

Video: Using list groups

Those groups are a new type of component that lets you create mobile-like lists with a lot of different options. You see the markup is pretty simple. You can create a list by using an unordered list, the class of list-group, and then a list item with list-group-item classes. And you can add chevrons pretty easily, as well as badges, to the right, and also make these into clickable components by making them into anchor tags. So let's take a look how that works. So starting off with the file from the movie Working With Panels. And the first thing we're going to do is just create a list, so we'll go ahead and remove this content right here and I'm going to give plenty of spacing. And I'll create a list, list will have a class of list group. And we're, we'll go ahead and add some list items and the list items will have a class of list-group-item.

Using list groups

Those groups are a new type of component that lets you create mobile-like lists with a lot of different options. You see the markup is pretty simple. You can create a list by using an unordered list, the class of list-group, and then a list item with list-group-item classes. And you can add chevrons pretty easily, as well as badges, to the right, and also make these into clickable components by making them into anchor tags. So let's take a look how that works. So starting off with the file from the movie Working With Panels. And the first thing we're going to do is just create a list, so we'll go ahead and remove this content right here and I'm going to give plenty of spacing. And I'll create a list, list will have a class of list group. And we're, we'll go ahead and add some list items and the list items will have a class of list-group-item.

Go in and make about five of those. Alright, so inside each one of these I'm going to type in just some text. So I'll just do first and so on and so forth. And I'll save that, and I'll refresh this page. Looks like I missed a hyphen here, so let me go ahead and fix that. I'll just add a hyphen, and refresh the page, and it should look like this. It just looks like a series of mobile device list elements. That's pretty cool. Notice that there's a little bit of padding around the list, and if you want that that's cool.

You can also add another class that is unordered list to make those flush, so I'll add a list-group-flush class there. And you can see that everything kind of goes up to the edge. So either way, whichever way you want to style them, that's great. Now let's go ahead and add some chevrons and then maybe some badges. They're pretty easy to do and it actually doesn't matter where you put them, so If I can do a span, with a class of glyphicon, and then I add another class of glyphicon, and then chevron-right, and I save that.

I get a chevron right here to the right hand side, which is pretty cool. I can also add a badge pretty easily, I'll just create a span with a class of badge, and then I can put a number in here, so I'll put the number ten and save that, and refresh. You can see the badge appears. Notice that the order does matter a little bit. I want to do the chevrons first and then the badge next, but it doesn't matter that I have the content before or after. It's just placing these where they need to go on the right-hand side. So that's actually pretty cool. Now if I want to get more complicated with my content, I can also define some sort of heading.

So I'll do an h4 with a class of list-group-item-heading, and let me put this content here inside. So I'll paste that, and then I'm just going to put some text here. So I'll put some long text and I'll save this and you can see that it aligned pretty well. I really do want to put in another class inside my text called list-group-item-text, and I know this is getting a little bit wordy but it really pays off to use these classes. It knows how to align things properly if you use them. So you can also make these into clickable elements by adding some anchor tags. And as a matter of fact, what I'm going to do is, I'll take the on order list here and change it to a div, and I'm going to take my list items and change them to anchor tags.

So I'm going to select this one, and I'm using sublime text here so you can do Cmd+D, Cmd+D, Cmd+D to get all the other ones. And then hit the right arrow and make a selection, and I'll change that to an anchor tag right here. Now because this is an anchor tag, I need to do an href, of, I'll just do #, because we don't really need to, link them to anywhere, we just need to show how they work. And then I need to find all the closing list items. This one's right here; select that one, Cmd+D a few times and then hit the right arrow. I have multiple cursors, and I can close all my anchor tags at the same time.

Save, and refresh, and now, you can see that these actually highlight. It's showing me the little hand icon, and these are actually clickable, and it made sure that it styled everything correctly when I did that, which is pretty awesome. You can also add a class of active to any element that you want to highlight as being an active link, and that's pretty cool. These additions to Bootstrap are very mobile-focused, but they give you a lot of power without having to do a lot of CSS. So I really like this addition to the Bootstrap framework.

Show transcript

This video is part of

Image for Bootstrap 3: New Features and Migration
Bootstrap 3: New Features and Migration

21 video lessons · 5293 viewers

Ray Villalobos
Author

 

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.

Join now "Already a member? Log in

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 Bootstrap 3: New Features and Migration.

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.