Search code examples
cssopacityrgba

What is the difference between opacity and that through alpha channel (rgba)?


div { background-color: rgb(255,0,0); opacity: 1; }

div { background-color: rgba(255,0,0,1); }

What is the difference between the above two?


Solution

  • Opacity sets the opacity value for an element and all of its children; While RGBA sets the opacity value only for a single declaration.

    This is well explained here. http://www.css3.info/introduction-opacity-rgba/