Lesson 5: Colors in Bootstrap 5

How are colors used in Bootstrap? In this article, lets explore everything about Bootstrap colors!

How are colors used in Bootstrap? In this article, let's explore everything about Bootstrap colors !

 

The Bootstrap 5 Colors utility is used to set text colors, for example, green for success, blue for basic, etc. There are many other necessary informational colors such as danger, warnings, etc. The Bootstrap color palette can help you find the right colors for your development project.

In this article, let's explore all the colors in Bootstrap 5 in more detail!

  • Lesson 1: What is Bootstrap 5?
  • Lesson 2: Learning about Containers
  • Lesson 3: Grid System in Bootstrap
  • Lesson 4: Typography in Bootstrap 5

Text color in Bootstrap 5

Bootstrap 5 has several contextual classes that are used to implicitly convey a certain meaning through color.

Basically, the colors in Bootstrap 5 include:

  • Text-primary is used to format certain important documents.
  • Text-success is used to indicate the success of a task in green.
  • Text-info presents a number of texts that provide information.
  • Text warnings are displayed in yellow.
  • Text-danger colors danger warning text in red.
  • Text-secondary for secondary content.
  • Text-white changes the text color to white.
  • Text-dark colors the text black.
  • Text-body colors the text by default, usually black.
  • Text-light is used to color text in a light gray hue.
  • Text-muted displays hidden text, usually in light gray.

Run the file below to see how the text color classes above will display the text colors.

 

 Ví dụ Bootstrap - TipsMake.com.com 

Contextual colors

Use contextual classes to convey meaning through color:

The text is muted.

Important document.

The text indicates success.

The text represents a number of pieces of information.

This text is a warning.

The document warns of danger.

Supplementary text.

This text is dark gray.

The default body color (usually black).

Light gray text (on a white background).

White text (on a white background).

You will receive the corresponding colors as shown below:

 

You can also add 50% opacity to black or white text using the classes .text-black-50or .text-white-50:

 Ví dụ Bootstrap trên QuanTriMang 

Create a blur effect for the text color.

Add 50% opacity to black or white text with the class .text-black-50 or .text-white-50:

Black text with 50% opacity on a white background.

White text with 50% opacity on a black background.

With the HTML file above, you will see the following result:

Background colors in Bootstrap 5

The class for background color includes: .bg-primary, .bg-success, .bg-info, .bg-warning, .bg-danger, .bg-secondary, .bg-darkand .bg-light.

Note that the background color will not set the text color, so in some cases, you will need to use the background color class along with the text color class .text-*.

Let's look at the example code below:

 Ví dụ Bootstrap - TipsMake.com.com 

Background color based on context

Use background color classes contextually.

Important document.

The text indicates success.

The text contains information.

This text is a warning.

The document warns of danger.

Secondary background color.

Dark gray background color.

The background color is grayish-white.

 

We will get the result as shown below:

Link colors in Bootstrap 4

In Bootstrap 4, these text classes can be used on links, making their color slightly darker when hovered over. You can see this when running the code below:

 Ví dụ Bootstrap - TipsMake.com.com 

Contextual link colors

Hover your mouse over the link to see the color change.

 Link bị muted. Link chính. Link thành công. Link thông tin. Link cảnh báo. Link nguy hiểm. Link phụ. Link màu xám đen. Link màu body/đen. Link màu xám. 

The links will then be displayed as follows:

Note : When tested on Bootstrap 5, these link effects do not show the same color changes as on Bootstrap 4.

Once you've mastered these color classes, you can customize the colors of your website content because this color system already includes all the most basic colors.

In general, the `color` class in Bootstrap 5 colors text, highlighting its importance within the document. On the other hand, classes associated with `background` will 'overlay' color on related elements. Classes associated with text and background have similar names but different prefixes. For text, the `text color` class will have the prefix `` .text-, while for background color, the prefix will be ` .bg-`.

Other Program articles
  • Lesson 4: Typography in Bootstrap 5

    căn giữa bootstrap 5 không khó. Đó là một phần trong typography. dưới đây là mọi điều bạn cần biết về typography trong bootstrap 5.
  • Lesson 3: Grid System in Bootstrap 5

    col trong bootstrap chỉ là một phần của hệ thống grid. bài viết sẽ cung cấp cho bạn mọi kiến thức cơ bản cần biết về grid system của css.
  • Lesson 1: What is Bootstrap 5? How to get started?

    cách sử dụng bootstrap 5 không quá khó. bài viết sẽ cho bạn biết bootstrap 5 là gì và cách dùng bootstrap 5.
  • Use the MCP connector correctly.

    các connector là phần ít được đề cập nhất trong routines. tài liệu hướng dẫn ban đầu chỉ dành vài đoạn cho chúng. mọi hướng dẫn đều bỏ qua bước cài đặt notion mcp . trong khi đó, cấu hình sai connector chiếm phần lớn các lỗi trong tuần đầu tiên
  • Cost Engineering: Keep costs below daily limits.

    ngoài giới hạn mỗi lần chạy, các routine cũng tiêu tốn tài nguyên đăng ký của bạn giống như những phiên tương tác. vì vậy, một lần chạy tiêu tốn 50.000 token sẽ được tính vào token và số lần chạy của bạn.
  • Comparing Routines with GitHub Actions, Zapier, n8n, and Cron

    routines nằm trong một hệ sinh thái đã có github actions, zapier, n8n, make, cron và hàng tá công cụ quản lý workflow khác. không công cụ nào trong số đó sẽ biến mất.
Category

System

Windows XP

Windows Server 2012

Windows 8

Windows 7

Windows 10

Wifi tips

Virus Removal - Spyware

Speed ​​up the computer

Server

Security solution

Mail Server

LAN - WAN

Ghost - Install Win

Fix computer error

Configure Router Switch

Computer wallpaper

Computer security

Mac OS X

Mac OS System software

Mac OS Security

Mac OS Office application

Mac OS Email Management

Mac OS Data - File

Mac hardware

Hardware

USB - Flash Drive

Speaker headset

Printer

PC hardware

Network equipment

Laptop hardware

Computer components

Advice Computer

Game

PC game

Online game

Mobile Game

Pokemon GO

information

Technology story

Technology comments

Quiz technology

New technology

British talent technology

Attack the network

Artificial intelligence

Technology

Smart watches

Raspberry Pi

Linux

Camera

Basic knowledge

Banking services

SEO tips

Science

Strange story

Space Science

Scientific invention

Science Story

Science photo

Science and technology

Medicine

Health Care

Fun science

Environment

Discover science

Discover nature

Archeology

Life

Travel Experience

Tips

Raise up child

Make up

Life skills

Home Care

Entertainment

DIY Handmade

Cuisine

Christmas

Application

Web Email

Website - Blog

Web browser

Support Download - Upload

Software conversion

Social Network

Simulator software

Online payment

Office information

Music Software

Map and Positioning

Installation - Uninstall

Graphic design

Free - Discount

Email reader

Edit video

Edit photo

Compress and Decompress

Chat, Text, Call

Archive - Share

Electric

Water heater

Washing machine

Television

Machine tool

Fridge

Fans

Air conditioning

Program

Unix and Linux

SQL Server

SQL

Python

Programming C

PHP

NodeJS

MongoDB

jQuery

JavaScript

HTTP

HTML

Git

Database

Data structure and algorithm

CSS and CSS3

C ++

C #

AngularJS

Mobile

Wallpapers and Ringtones

Tricks application

Take and process photos

Storage - Sync

Security and Virus Removal

Personalized

Online Social Network

Map

Manage and edit Video

Data

Chat - Call - Text

Browser and Add-on

Basic setup