Skip to content

no-js tab switcher #3

@coolaj86

Description

@coolaj86

Re: https://stackoverflow.com/a/71008554

dialog { display: block; }

dialog:not(:target):not([open]) { display: none; }
<html>
  <body>
      <p>
        <a href="#dialog">Open dialog</a>
      </p>

      <dialog id="dialog">
        <h2>Dialog</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
        <a href="#!">Close</a>
      </dialog>
  </body>
</html>

Not sure if this would have to enumerate every hash target (ex: #main, #settings) or if this could be done by some sort of dynamic class selector, but this should allow tabs without JavaScript.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions