search
HomeWeb Front-endBootstrap Tutorialbootstrap supports several list styles

bootstrap supports 6 list styles: 1. ul unordered list; 2. ol ordered list; 3. Removed list; 4. Inline list, which refers to changing the vertical list into a horizontal list, and Remove the bullets and keep the list displayed horizontally; 5. dl definition list; 6. Horizontal definition list.

bootstrap supports several list styles

The operating environment of this tutorial: Windows7 system, bootsrap3.3.7 version, DELL G3 computer

List--Introduction

In HTML documents, there are three main types of list structures: ordered lists, unordered lists, and definition lists. The specific tags used are described as follows: Unordered list

<ul>
    <li>…</li>
</ul>

Ordered list

<ol>
    <li>…</li>
</ol>

Definition list

<dl>
    <dt>…</dt>
    <dd>…</dd>
</dl>

Bootstrap provides six forms of lists based on usual usage:

☑ Unordered list

☑ Ordered list

☑ Go to point list

☑ Inline list

☑ Definition list

☑ Horizontal definition list

Next, let’s learn this provided by Bootstrap Six ways to use lists

<!DOCTYPE HTML>
< html>
	<head>
		<meta charset="utf-8">
		<title>列表--简介</title>
		<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
	</head>
	<body>
		<ul>
			<li>无序列表信息1</li>
			<li>无序列表信息2</li>
			<li>无序列表信息3</li>
		</ul>
		<ol>
			<li>有序列表信息1</li>
			<li>有序列表信息2</li>
			<li>有序列表信息3</li>
		</ol>
		<dl>
			<dt>定义列表标题</dt>
			<dd>定义列表信息1</dd>
			<dd>定义列表信息2</dd>
		</dl>
	</body>
	</html>

Lists--unordered lists, ordered lists

bootstrap supports several list stylesbootstrap supports several list styles

Unordered lists The usage of ordered lists is the same as what we usually use (unordered lists use ul, ordered lists use ol tags). In terms of style, Bootstrap has only made some subtle optimizations on this basis. Please view bootstrap.css for the source code. Lines 569 to 579 of the file:

ul,
ol {
  margin-top: 0;
  margin-bottom: 10px;
}
ul ul,
ol ul,
ul ol,
ol ol {
  margin-bottom: 0;
}

From the source code, we can know that Bootstrap only made some adjustments to the margin for the list.

List nesting

Lists can also be nested in Bootstrap.

List--Go to the list

You can see that by default in Bootstrap, unordered list and ordered list It has bullet points, but in many cases in actual work, our lists do not need this number, such as when using unordered lists for navigation. Bootstrap has been very considerate for many developers. By adding a class name ".list-unstyled" to the unordered list, the default list style can be removed. /*For the source code, please view lines 580~583 of the bootstrap.css file*/

.list-unstyled {
padding-left: 0;
list-style: none;
}

As can be seen from the example, in addition to the item number, the default left padding# of the list will also be included. ##Alsocleared0.

List--inline list

Bootstrap implements an inline list by adding the class name "

.list-inline" just like a list. To put it simply, That is replace the vertical list with a horizontal list, and remove the bullets (numbers) , keep the horizontal display. It can also be said that inline lists are born for creating horizontal navigation. /*View the source code for lines 584~593 of the bootstrap.css file*/

.list-inline {
padding-left: 0;
margin-left: -5px;
list-style: none;
}
.list-inline > li {
display: inline-block;
padding-right: 5px;
padding-left: 5px;
}

Look at an example:

<ul class="list-inline">
    <li>W3cplus</li>
    <li>Blog</li>
    <li>CSS3</li>
    <li>jQuery</li>
    <li>PHP</li>
</ul>

List--Definition list

bootstrap supports several list styles

For the definition list, Bootstrap did not make too many adjustments. It just adjusted

line spacing, margin and font bold Effect. /*For the source code, please view lines 594~607 of the bootstrap.css file*/

dl {
margin-top: 0;
margin-bottom: 20px;
}
dt,
dd {
line-height: 1.42857143;
}
dt {
font-weight: bold;
}
dd {
margin-left: 0;
}

For the use of definition lists, it is actually very simple. It is the same as our previous method of using definition lists:

<dl>
    <dt>W3cplus</dt>
    <dd>一个致力于推广国内前端行业的技术博客</dd>
    <dt>seashen.cn</dt>
    <dd>一个真心在做HTML5教育的网站</dd>
</dl>

List--Horizontal definition list

bootstrap supports several list styles

Horizontal definition list Just like the inline list, Bootstrap can add the class name "

. dl-horizontal" implements horizontal display effects for definition lists. /*For the source code, please view lines 608~621 of the bootstrap.css file*/

@media (min-width: 768px) {
.dl-horizontal dt {
float: left;
width: 160px;
overflow: hidden;
clear: left;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
  }
.dl-horizontal dd {
margin-left: 180px;
  }
}

A media query is added here. In other words, only when the screen

is larger than 768px, adding the class name ".dl-horizontal" will have the horizontal definition list effect. The main methods of implementation: 1. Set dt to a left float and set a width of 160px 2. Set dd to a margin-left value of 180px to achieve a horizontal effect 3. When the title width exceeds 160px , three ellipses

will be displayed and their usage is as follows:

<dl class="dl-horizontal">
    <dt>W3cplus</dt>
    <dd>一个致力于推广国内前端行业的技术博客。它以探索为己任,不断活跃在行业技术最前沿,努力提供高质量前端技术博文</dd>
    <dt>seashen.cn</dt>
    <dd>一个专业的HTML5网站</dd>
    <dt>我来测试一个标题,我来测试一个标题</dt>
    <dd>我在写一个水平定义列表的效果,我在写一个水平定义列表的效果</dd>
</dl>

When you shrink your browser screen, the horizontal definition list will return to its original state.

Recommended study: "

bootstrap usage tutorial"

The above is the detailed content of bootstrap supports several list styles. 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
10款好看又实用的Bootstrap后台管理系统模板(快来下载)10款好看又实用的Bootstrap后台管理系统模板(快来下载)Aug 06, 2021 pm 01:55 PM

一个好的网站,不能只看外表,网站后台同样很重要。本篇文章给大家分享10款好看又实用的Bootstrap后台管理系统模板,可以帮助大家快速建立强大有美观的网站后台,欢迎下载使用!如果想要获取更多后端模板,请关注php中文网后端模板栏目!

bootstrap与jquery是什么关系bootstrap与jquery是什么关系Aug 01, 2022 pm 06:02 PM

bootstrap与jquery的关系是:bootstrap是基于jquery结合了其他技术的前端框架。bootstrap用于快速开发Web应用程序和网站,jquery是一个兼容多浏览器的javascript库,bootstrap是基于HTML、CSS、JAVASCRIPT的。

7款实用响应式Bootstrap电商源码模板(快来下载)7款实用响应式Bootstrap电商源码模板(快来下载)Aug 31, 2021 pm 02:13 PM

好看又实用的Bootstrap电商源码模板可以提高建站效率,下面本文给大家分享7款实用响应式Bootstrap电商源码,均可免费下载,欢迎大家使用!更多电商源码模板,请关注php中文网电商源码​栏目!

8款Bootstrap企业公司网站模板(源码免费下载)8款Bootstrap企业公司网站模板(源码免费下载)Aug 24, 2021 pm 04:35 PM

好看又实用的企业公司网站模板可以提高您的建站效率,下面PHP中文网为大家分享8款Bootstrap企业公司网站模板,均可免费下载,欢迎大家使用!更多企业站源码模板,请关注php中文网企业站源码栏目!

bootstrap中sm是什么意思bootstrap中sm是什么意思May 06, 2022 pm 06:35 PM

在bootstrap中,sm是“小”的意思,是small的缩写;sm常用于表示栅格类“.col-sm-*”,是小屏幕设备类的意思,表示显示大小大于等于768px并且小于992px的屏幕设备,类似平板设备。

bootstrap modal 如何关闭bootstrap modal 如何关闭Dec 07, 2020 am 09:41 AM

bootstrap modal关闭的方法:1、连接好bootstrap的插件;2、给按钮绑定模态框事件;3、通过“ $('#myModal').modal('hide');”方法手动关闭模态框即可。

bootstrap默认字体大小是多少bootstrap默认字体大小是多少Aug 22, 2022 pm 04:34 PM

bootstrap默认字体大小是“14px”;Bootstrap是一个基于HTML、CSS、JavaScript的开源框架,用于快速构建基于PC端和移动端设备的响应式web页面,并且默认的行高为“20px”,p元素行高为“10px”。

bootstrap是免费的吗bootstrap是免费的吗Jun 21, 2022 pm 05:31 PM

bootstrap是免费的;bootstrap是美国Twitter公司的设计师“Mark Otto”和“Jacob Thornton”合作基于HTML、CSS、JavaScript 开发的简洁、直观、强悍的前端开发框架,开发完成后在2011年8月就在GitHub上发布了,并且开源免费。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),