Home  >  Article  >  Web Front-end  >  A detailed introduction to Bootstrap list groups

A detailed introduction to Bootstrap list groups

零下一度
零下一度Original
2017-07-20 09:31:021663browse

In this chapter we will explain list groups. The list component is used to present complex and custom content in the form of a list. The steps to create a basic list group are as follows:

Add class .list-group to the element ff6d136ddc5fdfeffaf53ff6ee95f185.

Add class .list-group-item to 25edfb22a4f469ecb59f1190150159c6.

The following example demonstrates this:

Example

<ul class="list-group">
    <li class="list-group-item">免费域名注册</li>
    <li class="list-group-item">免费 Window 空间托管</li>
    <li class="list-group-item">图像的数量</li>
    <li class="list-group-item">24*7 支持</li>
    <li class="list-group-item">每年更新成本</li></ul>

Basic list group

The basic list group looks like a list item with the list symbol removed and equipped with some specific styles. The basic list group in the Bootstrap framework mainly consists of two parts:

 ☑ list-group: list group container, commonly used is the ul element, of course it can also be an ol or div element

 ☑ list-group-item: list item, commonly used is the li element, of course it can also be the div element

For the basic list group, there are not many style settings, mainly setting its spacing, borders and rounded corners. Wait

.list-group {
  padding-left: 0;
  margin-bottom: 20px;
}.list-group-item {
  position: relative;
  display: block;
  padding: 10px 15px;
  margin-bottom: -1px;
  background-color: #fff;
  border: 1px solid #ddd;
}.list-group-item:first-child {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}.list-group-item:last-child {
  margin-bottom: 0;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 4px;
}
86ba7a910db1f851ade673353645313df496da2c0df4bc6d16ea49188db2a380HTMLbed06894275b65c1ab86501b08a632eb
f496da2c0df4bc6d16ea49188db2a380CSSbed06894275b65c1ab86501b08a632ebf496da2c0df4bc6d16ea49188db2a380javascriptbed06894275b65c1ab86501b08a632eb
f496da2c0df4bc6d16ea49188db2a380bootstrapbed06894275b65c1ab86501b08a632ebf496da2c0df4bc6d16ea49188db2a380jquerybed06894275b65c1ab86501b08a632eb
929d1f5ca49e04fdcb27f9465b944689

Badge

The list group with badge is actually a combination of the badge component in the Bootstrap framework and the basic list group. an effect. The specific method is very simple. You only need to add the badge component "badge"

in "list-group-item". The principle is very simple, that is, setting a right float for the badge. Of course, if there are two badges in one at the same time, When the list items appear, the distance between them is also set

.list-group-item > .badge {
  float: right;
}.list-group-item > .badge + .badge {
  margin-right: 5px;
}
86ba7a910db1f851ade673353645313df496da2c0df4bc6d16ea49188db2a38065a095448675e8d3ad55aa894fd9d7023354bdf357c58b8a65c66d7c19c8e4d114HTMLbed06894275b65c1ab86501b08a632ebf496da2c0df4bc6d16ea49188db2a38065a095448675e8d3ad55aa894fd9d7026054bdf357c58b8a65c66d7c19c8e4d114CSSbed06894275b65c1ab86501b08a632ebf496da2c0df4bc6d16ea49188db2a38065a095448675e8d3ad55aa894fd9d70219254bdf357c58b8a65c66d7c19c8e4d114javascriptbed06894275b65c1ab86501b08a632ebf496da2c0df4bc6d16ea49188db2a38065a095448675e8d3ad55aa894fd9d7022054bdf357c58b8a65c66d7c19c8e4d114bootstrapbed06894275b65c1ab86501b08a632ebf496da2c0df4bc6d16ea49188db2a38065a095448675e8d3ad55aa894fd9d7022654bdf357c58b8a65c66d7c19c8e4d114jquerybed06894275b65c1ab86501b08a632eb929d1f5ca49e04fdcb27f9465b944689


Link

Use the 3499910bf9dac5ae3c52d5ede7383485 tag instead of the 25edfb22a4f469ecb59f1190150159c6 tag to form a list group that is all links (also note that ## needs to be #ff6d136ddc5fdfeffaf53ff6ee95f185 tags are replaced with dc6dce4a544fdca2df29d5ac0ea9906b tags). There is no need to add a parent element to each element in the list group

a.list-group-item {
  color: #555;
}a.list-group-item .list-group-item-heading {
  color: #333;
}a.list-group-item:hover,
a.list-group-item:focus {
  color: #555;
  text-decoration: none;
  background-color: #f5f5f5;
}
1f2e350fb86f4fbcf304a3170516954f
  c6c9c9b8b3173ba91b723c08e0d6be97HTML5db79b134e9f6b82c0b36e0489ee08ed
  a16100a6f9717ef0222dddbefdffc896CSS5db79b134e9f6b82c0b36e0489ee08ed
  a16100a6f9717ef0222dddbefdffc896javascript5db79b134e9f6b82c0b36e0489ee08ed
  10520cbff229fcc96105ca9518f38965bootstrap5db79b134e9f6b82c0b36e0489ee08ed
  a16100a6f9717ef0222dddbefdffc896jquery5db79b134e9f6b82c0b36e0489ee08ed16b28748ea4df4d9c2150843fecfba68


Button

The elements in the list group can also be buttons directly (it also means that the parent element must be

dc6dce4a544fdca2df29d5ac0ea9906b instead of ff6d136ddc5fdfeffaf53ff6ee95f185 ), and there is no need to wrap a separate parent element for each button. Be careful not to use standard .btn classes

1f2e350fb86f4fbcf304a3170516954f
  6b50b67c135ab2e62492341b13f29373HTML65281c5ac262bf6d81768915a4a77ac0
  d68a9ee5ca1160520ed600ec9e3a7af9CSS65281c5ac262bf6d81768915a4a77ac0
  d68a9ee5ca1160520ed600ec9e3a7af9javascript65281c5ac262bf6d81768915a4a77ac0
  d68a9ee5ca1160520ed600ec9e3a7af9bootstrap65281c5ac262bf6d81768915a4a77ac0
  d68a9ee5ca1160520ed600ec9e3a7af9jquery65281c5ac262bf6d81768915a4a77ac016b28748ea4df4d9c2150843fecfba68


Customized content

The Bootstrap box adds two new styles based on the link list group:

☑ list-group-item-heading: used to define the list item header style

 ☑ list-group-item-text: used to define the main content of the list item

The biggest role of these two styles is to help developers customize the content of the list item

1f2e350fb86f4fbcf304a3170516954f1c6fe066df748bd658464a725be6fb6408a61dbdfb70aa5a89a93f2eeab2c3a6HTML0f6dfd1e3624ce5465eb402e300e01ae5dbe51645de9f2b73a7c61b3ea42b899HTML被认为是前端知识体系里面最简单的知识,几年前,很多人都推荐在W3C上学习个几天就能够基本掌握。但随着HTML5和移动端的强势发展,HTML的技能点也越来越难。世上无难事,好学好总结...94b3e26ee717c64999d7867364b1b4a35db79b134e9f6b82c0b36e0489ee08ed1c6fe066df748bd658464a725be6fb6408a61dbdfb70aa5a89a93f2eeab2c3a6CSS0f6dfd1e3624ce5465eb402e300e01ae5dbe51645de9f2b73a7c61b3ea42b899CSS是前端工程师的基本功,但好多执迷于学习javascript的人的基本功并不扎实。可能一些人从w3school网站匆匆过了一遍,只是对CSS常用概念有一些表面上的理解,就一头扎进javascript的深坑里跳不出来。实际上,javascript中比较复杂的逻辑很有可能使用CSS几行样式就能解决问题,而且性能还好。CSS之所以能成为一门优雅的语言,以及有其对应的重构工程师的岗位,是因为这本语言本身就有很强的存在价值,且真正要理解它并不容易。从CSS禅意花园开始,写CSS成为一种艺术。从CSS2.1到3再到4,CSS所涵盖的内容及可实现的功能得到了极大的丰富,使得CSS的学习成本也越来越高。再多的知识,一个知识点一个知识点去学,总能学明白...94b3e26ee717c64999d7867364b1b4a35db79b134e9f6b82c0b36e0489ee08ed1c6fe066df748bd658464a725be6fb6408a61dbdfb70aa5a89a93f2eeab2c3a6javascript0f6dfd1e3624ce5465eb402e300e01ae5dbe51645de9f2b73a7c61b3ea42b899javascript就如同魔法一样,它是一门充满活力、简单易用的语言,又是一门具有许多复杂微妙技术的语言。即使是经验丰富的javascript开发者,如果没有认真学习的话,也无法真正理解它们,这就是javascript的矛盾之处。由于javascript不必理解就可以使用,因此通常来说很难真正理解语言本身,这就是我们面临的挑战。不满足于只是让代码正常工作,而是想要弄清楚为什么,勇于挑战这条崎岖颠簸的少有人走的路,拥抱整个javascript...94b3e26ee717c64999d7867364b1b4a35db79b134e9f6b82c0b36e0489ee08ed    16b28748ea4df4d9c2150843fecfba68


State setting

The Bootstrap framework provides state effects for combined list items, especially linked list groups. Such as common status and disabled status, etc. The implementation method is similar to the previously introduced components. In the list group, you only need to add the class name to the corresponding list item:

 ☑ active: indicates the current state

 ☑ disabled: indicates the disabled state

.list-group-item.disabled,
.list-group-item.disabled:hover,
.list-group-item.disabled:focus {
  color: #777;
  background-color: #eee;
}.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
  z-index: 2;
  color: #fff;
  background-color: #428bca;
  border-color: #428bca;
}
1f2e350fb86f4fbcf304a3170516954f
  c6c9c9b8b3173ba91b723c08e0d6be97HTML5db79b134e9f6b82c0b36e0489ee08ed
  a16100a6f9717ef0222dddbefdffc896CSS5db79b134e9f6b82c0b36e0489ee08ed
  a16100a6f9717ef0222dddbefdffc896javascript5db79b134e9f6b82c0b36e0489ee08ed
  10520cbff229fcc96105ca9518f38965bootstrap5db79b134e9f6b82c0b36e0489ee08ed
  240d28e046b15bac6aa66060d9749335jquery5db79b134e9f6b82c0b36e0489ee08ed16b28748ea4df4d9c2150843fecfba68


Colorful List Group

The list group component is the same as the warning component , Bootstrap provides different background colors and text colors for different states. You can use these class names to define list items with different background colors

 ☑ List-group-item-success: Success, background color green

 ☑ list-group-item-info:Information, background color is blue

 ☑ list-group-item-warning:Warning, background color is yellow

 ☑ list -group-item-danger: Error, the background color is red

If you want to add a background color to the list item, you only need to add the corresponding class name

# based on "list-group-item" ##

1f2e350fb86f4fbcf304a3170516954f
1c6fe066df748bd658464a725be6fb64默认5db79b134e9f6b82c0b36e0489ee08ed
564697e6951cbe44a8c1e129362f7453成功5db79b134e9f6b82c0b36e0489ee08ed
e9c1f721ffe69308cd05e752fe40ea9b信息5db79b134e9f6b82c0b36e0489ee08ed
b35bfd6cac3e90ee9e8d9ce873ad6b28警告5db79b134e9f6b82c0b36e0489ee08ed
b650cad83cd8011e65e52f0c389d58a7错误5db79b134e9f6b82c0b36e0489ee08ed
16b28748ea4df4d9c2150843fecfba68

The above is the detailed content of A detailed introduction to Bootstrap list groups. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn