--- id: slds.guidance.utilities.position title: Position Utilities description: SLDS CSS positioning utility classes summary: "Utilities for CSS positioning (static, relative, absolute, fixed). Controls element positioning for dropdowns, modals, and overlays." artifact_type: reference domain: utilities topic: position content_format: structured complexity: intermediate audience: [implementer] tasks: [implement] refs: - slds.guidance.utilities - slds.guidance.overview.utilities tags: [utilities, position, css-positioning] keywords: [slds-is-relative, slds-is-absolute, slds-is-fixed, slds-is-static] --- # Position - CSS Positioning Control CSS positioning including static, relative, absolute, and fixed positioning. ## Core Classes | Class | CSS Property | Purpose | |-------|-------------|---------| | `slds-is-static` | `position: static` | Reset element to normal document flow | | `slds-is-relative` | `position: relative` | Position element relative to its normal position, create containing block for absolute children | | `slds-is-absolute` | `position: absolute` | Position element relative to nearest positioned ancestor | | `slds-is-fixed` | `position: fixed` | Position element relative to viewport | ## Common Patterns ### Dropdown Positioning ```html
``` ### Modal Overlay ```html
Modal content here
``` ### Badge Indicator ```html
5
``` ### Tooltip Positioning ```html
Helpful information
``` ### Sticky Elements ```html
Page header remains visible on scroll
``` ## Best Practices ✅ Use `slds-is-relative` on parent containers for absolutely positioned children ✅ Use `slds-is-absolute` for dropdowns, tooltips, and popovers ✅ Use `slds-is-fixed` for modals, backdrops, and viewport-relative elements ✅ Always specify positioning coordinates (`top`, `right`, `bottom`, `left`) ✅ Include appropriate `z-index` values for stacking context ✅ Use `slds-is-static` to reset positioning when needed ❌ Never use `slds-is-absolute` without a positioned ancestor ❌ Avoid `slds-is-fixed` for elements that should scroll with content ❌ Never position elements without defining coordinates ❌ Avoid excessive z-index values (stay within defined ranges) ## Z-Index Guidelines | Layer | Z-Index Range | Use For | |-------|---------------|---------| | Base content | 1-10 | Regular page elements | | Dropdowns | 5000-5999 | Dropdown menus, select lists | | Sticky elements | 6000-6999 | Sticky headers, navigation | | Modals | 9000-9999 | Modal dialogs, overlays | | Toasts | 10000+ | Toast notifications, alerts | ### Z-Index Example ```html
Dropdown
Sticky header
Modal
Toast
``` ## Positioning Coordinates When using position utilities, always define coordinates: | Coordinate | Description | Example | |------------|-------------|---------| | `top` | Distance from top edge | `top: 0` or `top: 100%` | | `right` | Distance from right edge | `right: 0` or `right: 1rem` | | `bottom` | Distance from bottom edge | `bottom: 0` or `bottom: 100%` | | `left` | Distance from left edge | `left: 0` or `left: 50%` | ### Coordinate Combinations ```html
``` ## Browser Compatibility All position utilities are fully supported in modern browsers: - Chrome 1+ - Firefox 1+ - Safari 1+ - Edge 12+ - No vendor prefixes required