News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

CSS problem

Started by Sir Osis of Liver, August 04, 2024, 02:19:14 PM

Previous topic - Next topic

Sir Osis of Liver

Been tinkering with Shawn's themes that have animated backgrounds, and have run into a wall trying to do something that should be simple.  If you look at Starflight here, I've made the wrapper somewhat transparent by setting opacity: 0.7.  Would like to set some elements to opacity: 1.0, so they're not transparent (look at post text .inner), but nothing works.  If I change opacity of any element within wrapper it has no effect, nor does z-index or rgba().  The consensus at stackoverflow seems to be that it can't be done, all elements within a parent inherit opacity and there's no way to change it.  Trying to avoid setting opacity for all elements within wrapper individually, which I've done in other themes.  Is there a workaround?

Plan B
When in Emor, do as the Snamors.
                              - D. Lister

dodos26

#1
Brother, indicate in the picture what you want to do because I don't understand what you mean.
Want to make the top bar transparent without affecting other things?
Find <div id="top_section" to edit dont use . use #top_section and add opacity: 0.7;


Or this?


Or this


Kindred

No, he wants to make the BACKGROUND and cotents of the container less opaque/partially transparent..

 but have the child container(s) be more/fully opaque on top of the partially transparent underlying layers defined by the parent container
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Antechinus

Quote from: Sir Osis of Liver on August 04, 2024, 02:19:14 PMThe consensus at stackoverflow seems to be that it can't be done, all elements within a parent inherit opacity and there's no way to change it.
Correct.


QuoteIs there a workaround?
You seem to have figured out the obvious one already.

Sir Osis of Liver

First idea was to make everything transparent then make specific elements opaque.  That didn't work for reason described above, was curious why not.  Plan B, which I'm currently running, uses rgba() to make wrapper transparent, but it doesn't affect child elements, so those are opaque and I can make any of them transparent as well.  Not planning to do too much of that, theme looks pretty good as is.
When in Emor, do as the Snamors.
                              - D. Lister

Advertisement: