Disable opacity on child element when parent element has opacity

后端 未结 6 1984
灰色年华
灰色年华 2020-12-05 06:30

I have a container with an opacity of 0.8. At the background, I have an image that shines through the content div. Now, I have a photo of my client in this

6条回答
  •  时光取名叫无心
    2020-12-05 07:14

    This might help others who would want to use opacity, preventing a certain child element from getting opaque.

    You can use :not() Selector. Take this sample.

    
    
    
    SAMPLE 1.
    I am not Opaque. Blah! Blah! Blah!
    I am Opaque. Blah! Blah! Blah!
    I am Opaque. Blah! Blah! Blah!
    SAMPLE 2.
    I am not Opaque. Blah! Blah! Blah!
    We are all Opaque.

    Output:

提交回复
热议问题