The new alpha value standard rgb() and rgba() functions

  • ERT:

The new syntax is to use three values without commas followed by a slash and the alpha channel of the color as a percentage.

Consider the following example of a slightly-transparent blue:

Don't

background-color: rgba(0, 0, 255, 0.8);

Do

background-color: rgb(0 0 100% / 80%);
Warning

At the time of writing, in scss (sass), not css, the rgb() will throw a compilation error like this:

Function rgb is missing argument ...

Do you have any project in mind?

Let's turn your ideas into something great.

Whether you're a business owner, entrepreneur, an organisation, Institution, or individual, I'm here to help you bring your ideas or projects to life. As a consultant, I offer expert guidance and support to help you turn your project into a reality. I'll work with you every step of the way to ensure your project is a success.

Arrange a consultation