← Back to release summary

Percentage opacity

Category
CSS
Type
New or changed feature
Status
Enabled by default (Chrome 78)
Intent stage
Evaluate readiness to ship

WPT details: Tests css/css-color/parsing/opacity-valid.html css/css-color/parsing/opacity-computed.html will show that percentages are accepted, and serialize as numbers.

Summary

Adds support for percentage values to the opacity properties, specifically, opacity, stop-opacity, fill-opacity, stroke-opacity, and shape-image-threshold. For example, opacity: 50%; is equivalent to opacity: 0.5; https://drafts.csswg.org/css-color/#transparency

Motivation

This brings consistency and spec compliance. The rgba() function already accepts percentage alpha value, for example rgba(0, 255, 0, 50%).

Standards & signals

Ecosystem

Docs: https://www.w3.org/TR/css-color-4/#transparency https://www.w3.org/TR/css-color-4/#typedef-alpha-value

View on chromestatus.com