The way to represent colors in HTML is by using 6-digit hexadecimal codes, RGB or keywords.

The way to represent colors in HTML is by using 6-digit hexadecimal codes, RGB or keywords.
There are three ways to represent colors in HTML, the most commonly used is the 6-digit hexadecimal code representation. For example, bgcolor=#ff0000; where # simply means declaring the color using a 6-digit hexadecimal color code. The first two digits of the code, ff, represent red among the three primary colors. The range is of course 00-ff in hexadecimal. The middle two digits, 00, represent green, and the last two digits, 00, represent blue. 00 represents no color, and ff represents the strongest color. So 000000 represents black, ffffff represents white, similarly ff0000 represents pure red, 00ff00 represents pure green, and 0000ff represents pure blue.

In addition, colors can also be expressed by RGB (r, g, b). The r, g, and b in the brackets represent red, green, and blue respectively using decimal numbers or percentages from 0 to 255. For example, rgb (255, 0, 0) and rgb (100%, 0%, 0%) both represent red.

Colors can also be represented by color keywords, a total of 16, namely:

Black#000000
Maroon dark brown#800000
Green Green#008000
Olive #808000
Navy Blue#000080
Purple Purple#800080
Teal #008080
Gray Gray#808080
Silver#C0C0C0
Red Red#FF0000
Lime #00FF00
Yellow Yellow#FFFF00
Blue #0000FF
Fuchsia Magenta #FF00FF
Aqua blue#00FFFF
White#FFFFFF

For example, you can write: bgcolor=red, which is equivalent to the following:

Copy code
The code is as follows:

bgcolor=rgb(255,0,0),bgcolor=rgb(100%,0%,0%),bgcolor=#ff0000;

<<:  Linux completely removes node.js and reinstalls it through the yum command

>>:  Thoughts and experience sharing on interactive design of reading lists for information products

Recommend

How to implement horizontal bar chart with percentage in echarts

Table of contents Example Code Rendering Code Ana...

Analysis of Vue element background authentication process

Preface: Recently, I encountered a management sys...

How to use Volume to transfer files between host and Docker container

I have previously written an article about file t...

Use overflow: hidden to disable page scrollbars

Copy code The code is as follows: html { overflow...

Detailed explanation of concat related functions in MySQL

1. concat() function Function: Concatenate multip...

HTML reuse techniques

HTML reuse is a term that is rarely mentioned. Tod...

React sample code to implement automatic browser refresh

Table of contents What is front-end routing? How ...

How to deploy SpringBoot project using Dockerfile

1. Create a SpringBooot project and package it in...

Why does using limit in MySQL affect performance?

First, let me explain the version of MySQL: mysql...

Detailed explanation of the use of MySQL sql_mode

Table of contents Preface sql_mode explained The ...

Native JavaScript to implement random roll call table

This article example shares the specific code of ...

Tips for implementing list loop scrolling based on jQuery (super simple)

I saw a good idea and recorded it. I have used jQ...

Document Object Model (DOM) in JavaScript

Table of contents 1. What is DOM 2. Select elemen...

A brief discussion on whether MySQL can have a function similar to Oracle's nvl

Use ifnull instead of isnull isnull is used to de...