Bootstrap Lists
Bootstrap provides simple and useful classes to style HTML lists and create clean, professional list layouts.
What is a List?
A list is a collection of related items displayed one after another.
HTML provides mainly three types of lists:
- Unordered List
- Ordered List
- Description List
Unordered List
An unordered list displays items using bullets. It is created using the <ul> and <li> elements.
Example
<ul>
<li>HTML</li>
<li>CSS</li>
<li>Bootstrap</li>
<li>JavaScript</li>
</ul>
Output
- HTML
- CSS
- Bootstrap
- JavaScript
Bootstrap .list-unstyled
The .list-unstyled class removes the default bullets and left padding from an unordered list.
Example
<ul class="list-unstyled">
<li>HTML</li>
<li>CSS</li>
<li>Bootstrap</li>
<li>JavaScript</li>
</ul>
Output
- HTML
- CSS
- Bootstrap
- JavaScript
Ordered List
An ordered list displays items using numbers. It is created using <ol> and <li>.
Example
<ol>
<li>Create Project</li>
<li>Install Bootstrap</li>
<li>Create Layout</li>
<li>Run Application</li>
</ol>
Output
- Create Project
- Install Bootstrap
- Create Layout
- Run Application
Bootstrap Inline List
The .list-inline class displays list items horizontally instead of vertically.
Each item should use the .list-inline-item class.
Example
<ul class="list-inline">
<li class="list-inline-item">HTML</li>
<li class="list-inline-item">CSS</li>
<li class="list-inline-item">Bootstrap</li>
<li class="list-inline-item">JavaScript</li>
</ul>
Output
- HTML
- CSS
- Bootstrap
- JavaScript
Nested Lists
A nested list is a list inside another list. It is useful when information has categories and subcategories.
Example
<ul>
<li>
Frontend
<ul>
<li>HTML</li>
<li>CSS</li>
<li>Bootstrap</li>
</ul>
</li>
<li>
Backend
<ul>
<li>C#</li>
<li>.NET Core</li>
<li>SQL Server</li>
</ul>
</li>
</ul>
Output
-
Frontend
- HTML
- CSS
- Bootstrap
-
Backend
- C#
- .NET Core
- SQL Server
Description List
A description list is used to display a term and its description.
HTML uses:
- <dl> - Description List
- <dt> - Description Term
- <dd> - Description Details
Example
<dl>
<dt>Bootstrap</dt>
<dd>A popular CSS framework.</dd>
<dt>HTML</dt>
<dd>Used to create web page structure.</dd>
</dl>
Output
- Bootstrap
- A popular CSS framework.
- HTML
- Used to create web page structure.
CIIT Training Institute Example
Suppose CIIT Training Institute wants to display available courses on a web page.
Course List
- 1. .NET Full Stack Development
- 2. Java Full Stack Development
- 3. Python Full Stack Development
- 4. Data Analytics
- 5. Software Testing
- 6. DevOps
Important Bootstrap List Classes
| Class / Element | Purpose |
|---|---|
<ul> |
Creates an unordered list |
<ol> |
Creates an ordered list |
<li> |
Creates a list item |
.list-unstyled |
Removes bullets and default padding |
.list-inline |
Creates an inline list |
.list-inline-item |
Displays list items inline |
<dl> |
Creates a description list |
<dt> |
Defines a description term |
<dd> |
Defines description details |
Common Mistakes
-
Forgetting to close
<li>elements. -
Using
.list-inlinewithout.list-inline-item. -
Using
.list-unstyledwhen bullets are actually required. - Creating unnecessarily complicated nested lists.
- Using a list when a table is more suitable for structured tabular data.
Summary
- HTML provides unordered, ordered and description lists.
- .list-unstyled removes default bullets and padding.
- .list-inline displays list items horizontally.
- .list-inline-item is applied to individual inline list items.
- Lists can also contain nested lists.
- Description lists use <dl>, <dt> and <dd>.
- Lists are useful for displaying courses, features, menus, categories and instructions.