So I have a section of text, like this:
<header>
<section id="intro">
<div class="container">
<div class="hidden-box">
<p>
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT
TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT
</p>
<p class="read-more">
<a href="#" class="button">Read More</a></p>
</div>
</div>
</section>
</header>
And I want to hide it, until a 'Read more' is clicked, and the remaining text is revealed. Before the reveal, I want the text to be semi-transparent, so as to not grab all the attention, and so I've made a hodgepodge of a styling (sass) like this
#intro
.container
max-width: 768px
color: black
.hidden-box
max-height: 50px
position: relative
overflow: hidden
color: #727272
opacity: 0.2
.hidden-box .read-more
position: absolute
bottom: 0
left: 0
width: 100%
text-align: center
margin: 0
padding: 0
opacity: 1
background-image: radial-gradient(white, transparent)
background-size: cover
.read-more .button
color: black
opacity: 1
font-weight: bold
Which works to hide the text and make it semi-transparent, until some javascript reveals it (sorry if it contains superfluous elements in this minimal example). Except, no matter what I do, the 'Read more' button is styled by its parent's opacity: 0.2
and not its own opacity: 1
.
What am I misunderstanding?