:target





css/style.css
  • :target {
  •  width: 100px;
  •  height: 30px;
  •  background-color: #ACBEF6;
  •  text-align: center;
  •  line-height: 30px;
  • }
:target {
 width: 100px;
 height: 30px;
 background-color: #ACBEF6;
 text-align: center;
 line-height: 30px;
}


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  • </head>
  • <body>
  •  <a href="#chapter1">Chapter1</a>
  •  <br />
  •  <a href="#chapter2">Chapter2</a>
  •  <br />
  •  <a href="#chapter3">Chapter3</a>
  •  <br />
  •  <br />
  •  <div>
  •   <p id="chapter1">Chapter1</p>
  •   <br />
  •   <p id="chapter2">Chapter2</p>
  •   <br />
  •   <p id="chapter3">Chapter3</p>
  •  </div>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  • </head>
  • <body>
  •  <a href="#chapter1">Chapter1</a>
  •  <br />
  •  <a href="#chapter2">Chapter2</a>
  •  <br />
  •  <a href="#chapter3">Chapter3</a>
  •  <br />
  •  <br />
  •  <div>
  •   <p id="chapter1">Chapter1</p>
  •   <br />
  •   <p id="chapter2">Chapter2</p>
  •   <br />
  •   <p id="chapter3">Chapter3</p>
  •  </div>
  • </body>
  • </html>