HTML color styles

PHPz
Release: 2023-09-14 12:25:05
forward
755 people have browsed it

Color is very important to give your website a good look and feel.

Hex Code (Hex Color Representation)

Hex is a 6-bit representation of color. The first two digits (RR) represent the red value, the next two digits are the green value (GG), and the last digit is the blue value (BB).

Software such as Adobe Photoshop can get hexadecimal values from any graphics. Each hexadecimal code will be preceded by a hash sign or pound sign #. Below is a list of several colors using hexadecimal notation. Here are some examples of hexadecimal colors -

HTML color styles

Let's see an example of implementing hexadecimal styles in HTML to represent colors -

Example

Live demo

    

Result

Id Name Percentage Rank
009 Tom 98 1
011 Kieron 97 2
039 Gayle 95 3
017 Shaun 92 4
009 Kane 91 5
025 Steve 87 6
013 Jack 85 7
023 Tim 84 8
Copy after login

Output

HTML color styles

##RGB color value

RGB color value is using rgb() attribute specified. This property takes three values, one each for red, green, and blue. The value can be an integer or a percentage between 0 and 255.

Here are some colors represented in RGB-

HTML color styles

HSL color values

Using HTML, you can also set HUE, which is " H" represents hue, "S" represents saturation, and "L" represents lightness.

Let's see an example of implementing HSL styles in HTML to represent colors -

Example

Live Demonstration

    

Result

Id Name Percentage Rank
009 Tom 98 1
011 Kieron 97 2
039 Gayle 95 3
017 Shaun 92 4
009 Kane 91 5
025 Steve 87 6
013 Jack 85 7
023 Tim 84 8
Copy after login
This will produce the following output-

HTML color styles

The above is the detailed content of HTML color styles. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!