I'm using :target
for creating this repo
CSS
section {
display: none;
}
section:target {
display: block;
}
HTML
<a href="#home">Home</a>
<a href="#about">About</a>
<section id="home">
You can create whole website just in single page.
</section>
<section id="about">
This is my tiny project. I'm love create code. I'm intersting for making code, program, websites.
</section>
Every time you click on those links #home
, #about
.
Adding on your current URL.
:target
is responding on any #
value. You see section:target
all section visible.
Top comments (2)
Yes, but this is
Still a neat trick though :)
The "target" bit might be useful in other situations, for example for "tab" navigation within content.
This idea may be best suitable for small, concise portfolio website.