New CSS draft includes support for Hex color values with alpha

By now you know that you can specify transparency in CSS color values (useful for properties like background-color) using the CSS RGBA function like this:

.transparent-blue {
   background-color: rgba(0, 0, 255, .5);
}

It turns out the new CSS Level 4 draft finally includes support for adding transparency to hex based color values – by using 8 digits instead of 6 giving 255 levels of opacity. Of course at the time this was being written its not supported by any browser but its good to know its coming. Here’s how it will look:

.new-transparent-blue {
   background-color: #0000ff88;
}

.new-transparent-blue-shorthand {
  background-color: #00f8;
}

Comments

comments