Get the App
SLTechnology News&Howtos  ›  Development  › 

How to represent the background color of CSS

Shulou Source: shulou.com Published: 2022-06-03 17:30:44 11月13日 Update

Editor to share with you how to express the background color of CSS, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. RGBA representation. A new way to represent colors in CSS3: RGBA or HSLA.

Background-color: rgba (0,0,255,0.3); border: 30px solid rgba (0,255,0,0.3)

Code interpretation:

2. RGBA: Red red, Green green, Blue blue, Alpha transparency.

The range of R, G, B is 0.255, and the range of transparency is 01.

3. HSLA representation.

Background-color: hsla (240, 50, 50, 50, 0.4)

Explanation:

H hue, with a range of 0,360. 0 or 360 for red, 120 for green, 240 for blue

S saturation, with a range of 0% to 100%. The greater the value, the brighter it is.

L brightness, with a range of 0% / 100%. The maximum brightness is white and the minimum is black.

A transparency, with a range of 0: 1.

About other ways to set transparency:

(1) opacity: 0.3; sets transparency for the entire box and subboxes. In other words, when the box is translucent, it will affect the subboxes inside.

(2) background: transparent; can set transparency separately, but the setting is completely transparent (non-adjustable transparency).

The above is all the content of this article "how to express the background color of CSS". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Transparency range box color article background brightness content mode representation interpretation maximum bright not much that is to say code most hours time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker MySQL Microsoft Huawei Redmi