CSS3 Gotcha: RGBA colours don’t work with spaces

February 21, 2011 (over a year ago)

I’m sure everyone knows about this but it surprised me at the time. If you have a space after ‘rgba’ in your colour statement, it won’t take effect.

This will work:
.mydiv { background: rgba(0, 0, 0, 0.5) }

This won’t work:
.mydiv { background: rgba (0, 0, 0, 0.5) }

(Note the space after ‘rgba’). Strange but true.

Tags: , , ,