JSFiddle - React, Tailwind, and code Playground
by Sven Kunz
HTML
<article class="infobox">
<span class="targetFix" id="allgemeines"></span>
<section id="">
<h2><a href="#allgemeines">Allgemeines</a></h2>
<p>Hier stehen ganz allgemeine Informationen.</p>
</section>
<span class="targetFix" id="funktionen"></span>
<section id="">
<h2><a href="#funktionen">Funktionen</a></h2>
<p>Hier stehen Informationen zu den Funktionen</p>
</section>
<span class="targetFix" id="preise"></span>
<section>
<h2><a href="#preise">Preise</a></h2>
<p>Hier stehen Informationen zu den Preisen.</p>
</section>
</article>
CSS
.targetFix {
position: fixed;
top: 0;
left: 0;
}
article.infobox section {
position: absolute;
display: block;
width: 400px;
height: 200px;
top: 100px;
background-color: #c5d2de;
}
article.infobox section h2 {
position: absolute;
left: 0;
top: -30px;
width: 124px;
height: 29px;
font-family: Verdana;
font-size: 15px;
margin: 0;
background-color: #194b7d;
border-radius: 15px 15px 0 0;
border: solid #ffffff;
border-width: 1px 1px 0 0;
z-index: 1;
}
article.infobox section:nth-of-type(2) h2 {
left: 120px;
z-index: 0;
}
article.infobox section:nth-of-type(3) h2 {
left: 240px;
z-index: -1;
}
article.infobox section h2 a {
display: block;
margin: 5px 0 0 0;
text-align: center;
text-decoration: none;
color: #c5d2de;
}
article.infobox span:target + section, article.infobox span:target + section h2 {
color: #000000;
background-color: #c5d2de;
z-index: 1;
}
article.infobox span:target + section h2 a {
color: #194b7d;
}
article.infobox section p {
font-family: Verdana;
font-size: 15px;
margin: 10px 10px 0 10px;
}