21 Aug 2022   html-css


You can style an element with css if its id attribute matches the window location’s hash using the :target pseudo-class:

<style>
#content {
  display: none;
}
#content:target {
  display: block
}
</style>

<a href="#content">See hidden content</a>

<table id="content">
  <legend>Keep is secret!
  <tr>
    <td>Keep it safe!
</table>

https://developer.mozilla.org/en-US/docs/Web/CSS/:target

🍄