1

i guess i'm getting kind of same result.

Please make me clear about this properties.

Naren
  • 135
  • 1
  • 8

3 Answers3

4

Opacity : Makes the whole element transparent including its content. Defining opacity:

element{opacity:0.5}

Background rgba (Red,Green,Blue,Opacity): It only makes the element background transparent leaving its content as it is. Defining Background rgba: background:

  element{
   background:rgba(40, 41, 42, 0.5);
   }

In both place, opacity value extends form 0 to 1. (Where value 1 acts as total opaque and 0 as complete transparent) To convert a hex value of color to rgb: Here

Suman KC
  • 3,478
  • 4
  • 30
  • 42
-1

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/

Arsen Ibragimov
  • 425
  • 4
  • 18
-1

They are not the same. Setting the background to a transparent color will do just that: the background will become see-through, but not the content. Setting the opacity affects the whole element.

Wander Nauta
  • 18,832
  • 1
  • 45
  • 62