The :Target Tabbed Menu

The :target selector can also be used to create a tabbed menu:

HTML file: Displayed by browser:
<style>
.tab div {
    display: none;
}
.tab div:target {
    display: block;
}
</style>
<body>
<div class="tab">
    <a href="#link1">Link 1</a>
    <a href="#link2">Link 2</a>
    <a href="#link3">Link 3</a>
    <div id="link1">
      <h3>Content to Link 1</h3>
      <p>Hello World!</p>
    </div>
    <div id="link2">
      <h3>Content to Link 2</h3>
      <h4>Great success!</h4>
    </div>
    <div id="link3">
      <h3>Content to Link 3</h3>
      <p>Yeah!</p>
    </div>
</div>
</body>
Link 1 Link 2 Link 3

Content to Link 1

Hello World!

Content to Link 2

Great success!

Content to Link 3

Yeah!


Back button Table of Contents Next button