The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Transparent Parent/Non Transparent Child Reply To: Transparent Parent/Non Transparent Child


What my goal is, have .content to have a bg-color of #333 with a opacity .3. When I did this prior it made the .imgGallery elements transparent as well. I attempted to put opacity 1 on the .imgGallery, hopeing this would work…and it didn’t.

To be clear, opacity is supposed to affect the entire element, including child elements (and text). After all, those child elements/nodes are a part of the parent element.

This is a very common point of confusion, sometimes even among more experienced coders. In short, opacity works just fine; it’s not a mistake or bug, and you aren’t doing anything specifically wrong. It’s just, often, “not the property you’re looking for.”

: )