zfb
GitHub repository

Type to search...

to open search from anywhere

Position

Set the positioning mode used to place an element in its containing block.

Use position to choose the reference for offsets and whether a box stays in normal flow. relative keeps its place and anchors absolute children; absolute leaves flow, fixed follows the preview viewport, and sticky sticks within a scrolling ancestor.

Quick reference

Example classExpected declarations
staticposition: static;
relativeposition: relative;
absoluteposition: absolute;
stickyposition: sticky;
fixedposition: fixed;
Example setup

Every preview explicitly starts from spec 1, reset "none", strict mode, spacingUnit "0.25rem", and no breakpoints. Numeric spacing values multiply that unit; no Tailwind theme is inherited. wind-demo classes are authored presentation scaffolding, with their CSS shown beside the exact HTML source.

Examples in use

Keep normal flow

static leaves the box in document flow; the top-4 and left-4 offsets are intentionally ignored.

Keep normal flow
HTML
<div class="wind-demo">
  <div class="wind-demo-frame w-64">
    <div class="wind-demo-tile static top-4 left-4">static ignores these offsets</div>
    <div class="wind-demo-tile">Normal-flow sibling</div>
  </div>
</div>
CSS
@layer zw-reset, zw-tokens, zfb-hi, base, components;
@layer zw-tokens {
  :root {
    --zw-spacing-unit: .25rem;
  }
}
.wind-demo {
  font: 14px / 1.45 system-ui, sans-serif;
  color: #203046;
}

.wind-demo-frame {
  border: 1px solid #9aaabd;
  background: #f8fafc;
  padding: .75rem;
}

.wind-demo-tile {
  border: 1px solid #849bb3;
  background: #dce8f2;
  color: #203046;
  padding: .5rem;
  text-align: center;
}
.static {
  position: static;
}
.left-4 {
  left: 1rem;
}
.top-4 {
  top: 1rem;
}
.w-64 {
  width: 16rem;
}
Configuration for this example
{
  "wind": {
    "spec": 1,
    "reset": "none",
    "strict": true,
    "tokens": {
      "spacingUnit": "0.25rem"
    },
    "breakpoints": {},
    "defaultTransitionTimingFunction": "ease",
    "authoredClasses": {
      "wind-demo": true,
      "wind-demo-frame": true,
      "wind-demo-tile": true
    },
    "safelist": {
      "docs-preview": [
        "left-4",
        "static",
        "top-4",
        "w-64"
      ]
    }
  }
}
Authored demonstration CSS
.wind-demo { font: 14px/1.45 system-ui, sans-serif; color: #203046; }
.wind-demo-frame { border: 1px solid #9aaabd; background: #f8fafc; padding: 0.75rem; }
.wind-demo-tile { border: 1px solid #849bb3; background: #dce8f2; color: #203046; padding: 0.5rem; text-align: center; }

Position against a nearby frame

relative stays in flow and establishes the reference box for its absolute child.

Position against a nearby frame
HTML
<div class="wind-demo">
  <div class="wind-demo-frame relative w-72 h-36">
    <div class="wind-demo-note">This box is the containing block.</div>
    <div class="wind-demo-tile absolute bottom-2 right-2">Pinned to this frame</div>
  </div>
</div>
CSS
@layer zw-reset, zw-tokens, zfb-hi, base, components;
@layer zw-tokens {
  :root {
    --zw-spacing-unit: .25rem;
  }
}
.wind-demo {
  font: 14px / 1.45 system-ui, sans-serif;
  color: #203046;
}

.wind-demo-frame {
  border: 1px solid #9aaabd;
  background: #f8fafc;
  padding: .75rem;
}

.wind-demo-note {
  color: #53677f;
  font-size: .875rem;
}

.wind-demo-tile {
  border: 1px solid #849bb3;
  background: #dce8f2;
  color: #203046;
  padding: .5rem;
  text-align: center;
}
.absolute {
  position: absolute;
}
.relative {
  position: relative;
}
.bottom-2 {
  bottom: 0.5rem;
}
.right-2 {
  right: 0.5rem;
}
.h-36 {
  height: 9rem;
}
.w-72 {
  width: 18rem;
}
Configuration for this example
{
  "wind": {
    "spec": 1,
    "reset": "none",
    "strict": true,
    "tokens": {
      "spacingUnit": "0.25rem"
    },
    "breakpoints": {},
    "defaultTransitionTimingFunction": "ease",
    "authoredClasses": {
      "wind-demo": true,
      "wind-demo-frame": true,
      "wind-demo-note": true,
      "wind-demo-tile": true
    },
    "safelist": {
      "docs-preview": [
        "absolute",
        "bottom-2",
        "h-36",
        "relative",
        "right-2",
        "w-72"
      ]
    }
  }
}
Authored demonstration CSS
.wind-demo { font: 14px/1.45 system-ui, sans-serif; color: #203046; }
.wind-demo-frame { border: 1px solid #9aaabd; background: #f8fafc; padding: 0.75rem; }
.wind-demo-note { color: #53677f; font-size: 0.875rem; }
.wind-demo-tile { border: 1px solid #849bb3; background: #dce8f2; color: #203046; padding: 0.5rem; text-align: center; }

Stick within a scroll area

sticky follows normal flow until top-0 reaches the scrollport, then remains there while its containing block continues.

Stick within a scroll area
HTML
<div class="wind-demo">
  <p class="wind-demo-note">Scroll inside the panel to see the heading stick to its top edge.</p>
  <div class="wind-demo-frame h-36 overflow-y-auto">
    <div class="h-12 wind-demo-muted">Earlier content</div>
    <div class="sticky top-0 wind-demo-tile">Sticky section heading</div>
    <div class="h-24 wind-demo-tile">Long section content</div>
    <div class="h-24 wind-demo-muted">More content</div>
  </div>
</div>
CSS
@layer zw-reset, zw-tokens, zfb-hi, base, components;
@layer zw-tokens {
  :root {
    --zw-spacing-unit: .25rem;
  }
}
.wind-demo {
  font: 14px / 1.45 system-ui, sans-serif;
  color: #203046;
}

.wind-demo-frame {
  border: 1px solid #9aaabd;
  background: #f8fafc;
  padding: .75rem;
}

.wind-demo-muted {
  background: #eef1f4;
  color: #64758a;
  border: 1px solid #cbd3dc;
}

.wind-demo-note {
  color: #53677f;
  font-size: .875rem;
}

.wind-demo-tile {
  border: 1px solid #849bb3;
  background: #dce8f2;
  color: #203046;
  padding: .5rem;
  text-align: center;
}
.sticky {
  position: sticky;
}
.top-0 {
  top: 0;
}
.h-12 {
  height: 3rem;
}
.h-24 {
  height: 6rem;
}
.h-36 {
  height: 9rem;
}
.overflow-y-auto {
  overflow-y: auto;
}
Configuration for this example
{
  "wind": {
    "spec": 1,
    "reset": "none",
    "strict": true,
    "tokens": {
      "spacingUnit": "0.25rem"
    },
    "breakpoints": {},
    "defaultTransitionTimingFunction": "ease",
    "authoredClasses": {
      "wind-demo": true,
      "wind-demo-frame": true,
      "wind-demo-muted": true,
      "wind-demo-note": true,
      "wind-demo-tile": true
    },
    "safelist": {
      "docs-preview": [
        "h-12",
        "h-24",
        "h-36",
        "overflow-y-auto",
        "sticky",
        "top-0"
      ]
    }
  }
}
Authored demonstration CSS
.wind-demo { font: 14px/1.45 system-ui, sans-serif; color: #203046; }
.wind-demo-frame { border: 1px solid #9aaabd; background: #f8fafc; padding: 0.75rem; }
.wind-demo-muted { background: #eef1f4; color: #64758a; border: 1px solid #cbd3dc; }
.wind-demo-note { color: #53677f; font-size: 0.875rem; }
.wind-demo-tile { border: 1px solid #849bb3; background: #dce8f2; color: #203046; padding: 0.5rem; text-align: center; }

Pin to the preview viewport

fixed uses bottom-2 and right-2 against the iframe viewport rather than the scroll panel.

Pin to the preview viewport
HTML
<div class="wind-demo">
  <p class="wind-demo-note">The chip is fixed to this preview viewport. Scroll the panel if needed.</p>
  <div class="wind-demo-frame h-36 overflow-y-auto">
    <div class="h-24 wind-demo-muted">Scroll content</div>
    <div class="h-24 wind-demo-tile">More content</div>
  </div>
  <div class="fixed bottom-2 right-2 wind-demo-highlight">Viewport chip</div>
</div>
CSS
@layer zw-reset, zw-tokens, zfb-hi, base, components;
@layer zw-tokens {
  :root {
    --zw-spacing-unit: .25rem;
  }
}
.wind-demo {
  font: 14px / 1.45 system-ui, sans-serif;
  color: #203046;
}

.wind-demo-frame {
  border: 1px solid #9aaabd;
  background: #f8fafc;
  padding: .75rem;
}

.wind-demo-highlight {
  background: #f2d794;
  color: #493810;
  border: 1px solid #b39761;
  text-align: center;
}

.wind-demo-muted {
  background: #eef1f4;
  color: #64758a;
  border: 1px solid #cbd3dc;
}

.wind-demo-note {
  color: #53677f;
  font-size: .875rem;
}

.wind-demo-tile {
  border: 1px solid #849bb3;
  background: #dce8f2;
  color: #203046;
  padding: .5rem;
  text-align: center;
}
.fixed {
  position: fixed;
}
.bottom-2 {
  bottom: 0.5rem;
}
.right-2 {
  right: 0.5rem;
}
.h-24 {
  height: 6rem;
}
.h-36 {
  height: 9rem;
}
.overflow-y-auto {
  overflow-y: auto;
}
Configuration for this example
{
  "wind": {
    "spec": 1,
    "reset": "none",
    "strict": true,
    "tokens": {
      "spacingUnit": "0.25rem"
    },
    "breakpoints": {},
    "defaultTransitionTimingFunction": "ease",
    "authoredClasses": {
      "wind-demo": true,
      "wind-demo-frame": true,
      "wind-demo-highlight": true,
      "wind-demo-muted": true,
      "wind-demo-note": true,
      "wind-demo-tile": true
    },
    "safelist": {
      "docs-preview": [
        "bottom-2",
        "fixed",
        "h-24",
        "h-36",
        "overflow-y-auto",
        "right-2"
      ]
    }
  }
}
Authored demonstration CSS
.wind-demo { font: 14px/1.45 system-ui, sans-serif; color: #203046; }
.wind-demo-frame { border: 1px solid #9aaabd; background: #f8fafc; padding: 0.75rem; }
.wind-demo-highlight { background: #f2d794; color: #493810; border: 1px solid #b39761; text-align: center; }
.wind-demo-muted { background: #eef1f4; color: #64758a; border: 1px solid #cbd3dc; }
.wind-demo-note { color: #53677f; font-size: 0.875rem; }
.wind-demo-tile { border: 1px solid #849bb3; background: #dce8f2; color: #203046; padding: 0.5rem; text-align: center; }

Custom and named values

The five class names are exact and have no values. Offset utilities such as top-4 only move positioned boxes; static ignores offsets and cannot anchor absolute descendants. Sticky needs a non-auto inset threshold and a scrolling context. A transformed ancestor can also establish a containing block for fixed descendants in CSS.

Related guides: Utility grammar · Variants

Catalog details

absolute

FieldValue
Catalog identifierv1.absolute
Class patternabsolute
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankposition (2)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesposition

Accepted values

KindSuffixEmitted value
exactnull"absolute"

Declaration templates

PropertyValue kindFixed value
positionresolvednull

Catalog examples

Example classExpected declarations
absoluteposition: absolute

fixed

FieldValue
Catalog identifierv1.fixed
Class patternfixed
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankposition (2)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesposition

Accepted values

KindSuffixEmitted value
exactnull"fixed"

Declaration templates

PropertyValue kindFixed value
positionresolvednull

Catalog examples

Example classExpected declarations
fixedposition: fixed

relative

FieldValue
Catalog identifierv1.relative
Class patternrelative
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankposition (2)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesposition

Accepted values

KindSuffixEmitted value
exactnull"relative"

Declaration templates

PropertyValue kindFixed value
positionresolvednull

Catalog examples

Example classExpected declarations
relativeposition: relative

static

FieldValue
Catalog identifierv1.static
Class patternstatic
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankposition (2)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesposition

Accepted values

KindSuffixEmitted value
exactnull"static"

Declaration templates

PropertyValue kindFixed value
positionresolvednull

Catalog examples

Example classExpected declarations
staticposition: static

sticky

FieldValue
Catalog identifierv1.sticky
Class patternsticky
Grammar{"acceptedKinds":["exact"],"arbitraryProperty":null,"allowsFractionSlash":false,"allowsColorOpacity":false}
Accepted values1
Token categoriesNo token category
Negative-value policyforbidden
Conflict group and rankposition (2)
Order rank0
Selector shapeownElement
Spec version1
Emitter propertiesposition

Accepted values

KindSuffixEmitted value
exactnull"sticky"

Declaration templates

PropertyValue kindFixed value
positionresolvednull

Catalog examples

Example classExpected declarations
stickyposition: sticky

Revision History

CreatedUpdated