I have following page
section {
height: 1000px;
background: yellow;
margin: 50px;
}
<section id="one">Section one</section>
<section id="two">Section two</section>
It is possible using html/css only to show only ONE section if user came from link which contains section id after hash e.g
?
You can investigate the use of the :target
pseudo-class, but you might struggle to show all of the sections when the URL hash is empty.
For example:
section:not(:target) { display:none; }
section:target { display: block }
<a href="#one">One</a>
<a href="#two">Two</a>
<section id="one">Section one</section>
<section id="two">Section two</section>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With