Is there a way to use the same CSS selector #Overlay:target
that currently hides the overlay to show content instead, or is there a more effective method? Here's what I'm dealing with:
I've implemented an overlay that displays a dismissible message when a page loads. However, the content loads in the background causing my page to be scrollable. Upon testing in Opera Mini, I noticed that the content is displayed in the background as it doesn't seem to support transparency.
To address this issue, I decided to keep the background content hidden until the message is dismissed rather than using a transparent layer to cover it up.
Below is the modified CSS I'm using:
#Overlay {
width: 500px; max-width:85%;
margin:0 auto;
position:relative;
z-index:10;
display:block;
background-color:#363b59; }
#Overlay:target { display:none;}
#content { display:none;}
Here's my HTML setup:
<div id="Overlay">
<p>overlay content</p>
<a href="#Overlay">cancel</a>
</div>
<div id="content">
<p>content goes here</p>
</div>