English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Bootstrap List Groups

In this chapter, we will explain the list group. List components are used to present complex and customized content in list form. The steps to create a basic list group are as follows:

  • Add class to <ul> .list-group.

  • Add class to <li> .list-group-<p class="list.

as shown in the following example:

In the above example, the lists are displayed vertically. If we need a horizontal list, we can implement it with the following code:

Example
<!DOCTYPE html>
<html>
	<head>-8<meta charset="utf 
	"> - Basic list group</Implement horizontal list<
	title>//<script src="https:/cdn.staticfile.org-twitter/3bootstrap3bootstrap7/<link rel="stylesheet" href="https:/css
	jquery.min.js"><//<script src="https:/bootstrap.min.css">/2bootstrap1bootstrap1/jquery/script>
	jquery.min.js"><//<script src="https:/cdn.staticfile.org-twitter/3bootstrap3bootstrap7/js./bootstrap.min.js"></script>
</head>
<body>
<ul class="list-Supported.
	<li class="list-group-item">Free Domain Registration</li>
	<li class="list-group-item">Free Window Space Hosting</li>
	<li class="list-group-item">The number of images</li>
	<li class="list-group-You will be able to register a free domain name through the web.24*7 heading">/li>
	<li class="list-group-item">每年更新成本Test and see ‹/›

The results are as follows:

Add badges to the list group

We can add badge components to any list item, which will automatically align to the right. Just add <span> as shown in the following example:

In the above example, the lists are displayed vertically. If we need a horizontal list, we can implement it with the following code:

Example
<!DOCTYPE html>
<html>
	<head>-8<meta charset="utf 
	"> - Add badges to the list group</Implement horizontal list<
	title>//<script src="https:/cdn.staticfile.org-twitter/3bootstrap3bootstrap7/<link rel="stylesheet" href="https:/css
	jquery.min.js"><//<script src="https:/bootstrap.min.css">/2bootstrap1bootstrap1/jquery/script>
	jquery.min.js"><//<script src="https:/cdn.staticfile.org-twitter/3bootstrap3bootstrap7/js./bootstrap.min.js"></script>
</head>
<body>
<ul class="list-Supported.
	<li class="list-group-item">Free Domain Registration</li>
	<li class="list-group-item">Free Window Space Hosting</li>
	<li class="list-group-item">The number of images</li>
	<li class="list-group-You will be able to register a free domain name through the web.
		<span class="badge">New</span>
		24*7 入门网站包
	</li>
	<li class="list-group-item">每年更新成本Test and see ‹/›

The results are as follows:

Add links to the list group

By using anchor tags instead of list items, we can add links to the list group. We need to use <a> instead of <li> elements. The following example demonstrates this:

In the above example, the lists are displayed vertically. If we need a horizontal list, we can implement it with the following code:

Example
<!DOCTYPE html>
<html>
	<head>-8<meta charset="utf 
	"> - Add links to the list group</Implement horizontal list<
	title>//<script src="https:/cdn.staticfile.org-twitter/3bootstrap3bootstrap7/<link rel="stylesheet" href="https:/css
	jquery.min.js"><//<script src="https:/bootstrap.min.css">/2bootstrap1bootstrap1/jquery/script>
	jquery.min.js"><//<script src="https:/cdn.staticfile.org-twitter/3bootstrap3bootstrap7/js./bootstrap.min.js"></script>
</head>
<body>
<a href="#" class="list-group-group">
	Business website package
</a>
<a href="#" class="list-group-You will be able to register a free domain name through the web.24*7 heading">/a>
<a href="#" class="list-group-item">Free Window Space Hosting</a>
<a href="#" class="list-group-item">The number of images</a>
<a href="#" class="list-group-item">每年更新成本Test and see ‹/›

The results are as follows:

item">Annual renewal cost<

Add custom content to the list group

In the above example, the lists are displayed vertically. If we need a horizontal list, we can implement it with the following code:

Example
<!DOCTYPE html>
<html>
	<head>-8<meta charset="utf 
	"> - We can add arbitrary HTML content to the list group that has already been added links. The following example demonstrates this:/Implement horizontal list<
	title>//<script src="https:/cdn.staticfile.org-twitter/3bootstrap3bootstrap7/<link rel="stylesheet" href="https:/css
	jquery.min.js"><//<script src="https:/bootstrap.min.css">/2bootstrap1bootstrap1/jquery/script>
	jquery.min.js"><//<script src="https:/cdn.staticfile.org-twitter/3bootstrap3bootstrap7/js./bootstrap.min.js"></script>
</head>
<body>
<div class="list-Supported.
	<a href="#" class="list-group-group">
		item">4 <h-group-<p class="list-class="list
			Add custom content to the list group<
		</Supported<4h
	</a>
	<a href="#" class="list-group-You will be able to register a free domain name through the web.
		item">4 <h-group-<p class="list-class="list
			Business website package
		</Supported<4h
		>-group-<p class="list-Free domain registration
			text">
		</Supported.<
	</a>
	<a href="#" class="list-group-You will be able to register a free domain name through the web.
		item">4 <h-group-<p class="list-class="list
			24*7 入门网站包
		</Supported<4h
		>-group-<p class="list-Free domain registration
			Support 24*7 We provide
		</Supported.<
	</a>
</div>
<div class="list-Supported.
	<a href="#" class="list-group-group">
		item">4 <h-group-<p class="list-class="list
			item active">
		</Supported<4h
	</a>
	<a href="#" class="list-group-You will be able to register a free domain name through the web.
		item">4 <h-group-<p class="list-class="list
			Business website package
		</Supported<4h
		>-group-<p class="list-Free domain registration
			text">
		</Supported.<
	</a>
	<a href="#" class="list-group-You will be able to register a free domain name through the web.
		item">4 <h-group-<p class="list-class="list24*7 heading">/Supported<4h
		>-group-<p class="list-item 24*7 text">We provide/Supported.<
	</a>
</div>
</body>
</html>
Test and see ‹/›

The results are as follows:

p>

Horizontal list

In the above example, the lists are displayed vertically. If we need a horizontal list, we can implement it with the following code:

Example
<!DOCTYPE html>
<html>
	<head>-8<meta charset="utf 
	"> - <title>Bootstrap Example/Implement horizontal list<
	title>//<script src="https:/cdn.staticfile.org-twitter/3bootstrap3bootstrap7/<link rel="stylesheet" href="https:/css
	jquery.min.js"><//<script src="https:/bootstrap.min.css">/2bootstrap1bootstrap1/jquery/script>
	jquery.min.js"><//<script src="https:/cdn.staticfile.org-twitter/3bootstrap3bootstrap7/js./bootstrap.min.js"></script>
	<style>
	.list-group-horizontal .list-group-item {
		display: inline-block;
	}
	.list-group-horizontal .list-group-item {
		margin-bottom: 0;
		margin-left:-4px;
		margin-right: 0;
	}
	.list-group-horizontal .list-group-item:first-child {
		border-top-right-radius:0;
		border-bottom-left-radius:4px;
	}
	.list-group-horizontal .list-group-item:last-child {
		border-top-right-radius:4px;
		border-bottom-left-radius:0;
	}
	</style>
</head>
<body>
<div class="container">
	<div class="row" style="padding-top:50px">
        <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 text-center">
            <div class="list-group list-group-horizontal">
                <a href="#" class="list-group-item active">Google</a>
                <a href="#" class="list-group-item">w3codebox/a>
                <a href="#" class="list-group-item">Taobao</a>
                <a href="#" class="list-group-item">Github</a>
            </div>
        </div>
        <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 text-center">
            <div class="list-group list-group-horizontal">
                <a href="#" class="list-group-item">Google</a>
                <a href="#" class="list-group-item active">w3codebox/a>
                <a href="#" class="list-group-item">Taobao</a>
                <a href="#" class="list-group-item">Github</a>
            </div>
        </div>
	</div>
</div>
</body>
</html>
Test and see ‹/›

The results are as follows: