mica

Example

pinned top

the explicit principal element

pinned bottom ↓

Basic usage

<m-cover>
  <nav>…</nav>
  <h1>Page title</h1>
  <p data-principal>Big campaign message</p>
  <p>scroll ↓</p>
</m-cover>

API

Fills the viewport and centers one principal child while pinning surrounding content to the edges.

Attributes

NameType/ValuesDefaultDescription
gapnone · 2xs · xs · sm · md · lg · xl · 2xlmdSets the space between children.
padnone · sm · md · lg · xlmdSets padding on every side.

Content/markup contract

NameType/ValuesDefaultDescription
Principal childh1 or a child with boolean data-principalh1The principal element is vertically centered. An explicit data-principal child wins over the h1; children before it pin to the top and children after it pin to the bottom.

Styling

NameType/ValuesDefaultDescription
--min-heightCSS length100svhOverrides the cover's minimum height.
← framebutton →