JSFiddle - React, Tailwind, and code Playground

by sfoster

HTML

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="pragma" content="no-cache"/>
    <title>Settings</title>
    <style>
    </style>
</head>
<body>
    <section role="region" id="wifi-status" data-leaf>

      <header class="first-header">
          <h1 data-l10n-id="keyboard">Should be snug top/left and stay there when we scroll</h1>
      </header>
      <p>
          Should sit tight below the header</p>
      <ul>
        <li>
          <label>
            <input name="keyboard.vibration" type="checkbox">
            <span></span>
          </label>
          <a data-l10n-id="vibration">Vibration</a>
        </li>
        <li>
          <label>
            <input name="keyboard.clicksound" checked="" type="checkbox">
            <span></span>
          </label>
          <a data-l10n-id="clickSound">Click sound</a>
        </li>
        <li>
          <label>
            <input name="keyboard.wordsuggestion" type="checkbox">
            <span></span>
          </label>
          <a data-l10n-id="wordSuggestion">Word suggestion</a>
        </li>
      </ul>

      <header>
        <h2 data-l10n-id="keyboardLayouts">Keyboard Layouts</h2>
      </header>
      <ul>
        <li>
          <label>
            <input name="keyboard.layouts.english" checked="" type="checkbox">
            <span></span>
          </label>
          <a data-l10n-id="english">English</a>
        </li>
        <li>
          <label>
            <input name="keyboard.layouts.dvorak" type="checkbox">
            <span></span>
          </label>
          <a data-l10n-id="dvorak">English (Dvorak)</a>
        </li>
        <li>
          <label>
            <input name="keyboard.layouts.spanish" type="checkbox">
            <span></span>
          </label>
          <a data-l10n-id="spanish">Spanish</a>
        </li>
        <li>
          <label>
            <input name="keyboard.layouts.portuguese" type="checkbox">
            <span></span>
          </label>
...

CSS

html, body {
    font-family: "Open Sans",sans-serif;
    font-size: 10px;
    margin: 0;
    overflow: hidden !important;
    padding: 0;
}
/*  this rule is applied to the active section (view)
    as we transition btw. inactive and active, visibility and transform properties are animated
 */
#wifi-status[role="region"], 
[role="region"]:target {
  visibility: visible;
  transform: translate(0, 0);
  /* setting transform: none fixes the issue
     ..but that clears *all* transforms not just the translate */
  /* transform: none; */
  transition: visibility 0s ease, transform .5s ease;
}
/* this rule is applied to all sections (views) */
[role="region"] {
    border: 0 none;
    height: 100%;
    left: 0;
    overflow-y: scroll;
    padding: 0;
    position: absolute;
    top: 0;
    width: 100%;
    background-color: #ff0;
    transform: translate(100%, 0);
    transition: visibility 0s ease .5s, transform .5s ease;
}
/* we want the main header to be fixed, and everything else to scroll */
[role="region"]:not(#root) > header:first-child {
    position: fixed;
    width: 100%;
}

/* leave room for the header */
[role="region"] > header:first-child + * {
  margin-top: 5rem;
}

section[role="region"] > header:first-child {
    background: #3c3;
    border: medium none;
    color: #FFFFFF;
    height: 5rem;
    padding: 0;
    position: relative;
    z-index: 10;
}
section[role="region"] > header:first-child > button, section[role="region"] > header:first-child > a {
    background: #339;
    height: 5rem;
    left: 0;
    overflow: hidden;
    position: absolute;
    text-align: center;
    width: 4rem;
}
[role="region"]:not(#root) > header:first-child + * {
    margin-top: 5rem;
    background-color: #f30;
}