Anchored Auto Layout
npm

Hover or focus a box to measure it. Click its tag, or press ] and [, to pin one. Esc unpins.

    Legend
    • Anchor: a box with data-⚓️-name
    • Placed by anchors: out of flow
    • Gap from the anchor's edge, in px
    • Edges of the box you're inspecting

    Every tag, line and number here is itself placed by data-⚓️-* attributes. JS only measures.

    Archive an email: the row's height glides shut and the rest slide up

    An email list where each message is an invisible slot with a visible card data-⚓️-fill on it and data-⚓️-transition=glide.

    Full page
    <main class="demo">
      <header class="intro">
        <h1>Archive and slide</h1>
        <p>
          Each email is an invisible slot in a plain list, with the visible card <code>data-⚓️-fill</code> on its slot and
          <code>data-⚓️-transition="glide"</code>. Archiving only sets the slot's height to zero: the list reflows <em>instantly</em>,
          so the archived card's height glides shut and every card below glides up into its new position.
          The inbox panel behind them is anchored to the whole list too, so it shrinks with them.
          The script flips one attribute per click.
        </p>
      </header>
    
      <div class="controls">
        <button type="button" id="undo" disabled>Undo</button>
        <button type="button" id="reset" disabled>Restore all</button>
        <output class="readout" id="readout" aria-live="polite"></output>
        <label class="xray-toggle"><input type="checkbox" name="xray"> X-ray (show the slots)</label>
      </div>
    
      <div class="inbox" data-⚓️-root>
        <div class="panel" aria-hidden="true"
          data-⚓️-to="--list" data-⚓️-fill data-⚓️-transition="glide"></div>
        <div class="list" data-⚓️-name="--list"></div>
      </div>
    </main>

    data-⚓️-filldata-⚓️-namedata-⚓️-rootdata-⚓️-todata-⚓️-transition

    Copied