Layout
Utilities for controlling the placement of positioned elements.
Class | Styles |
---|---|
inset-<number> | inset: calc(var(--spacing) * <number>); |
inset-<fraction> | inset: calc(<fraction> * 100%); |
inset-px | inset: 1px; |
inset-auto | inset: auto; |
inset-full | inset: 100%; |
inset-x-<number> | inset-inline: calc(var(--spacing) * <number>); |
inset-x-<fraction> | inset-inline: calc(<fraction> * 100%); |
inset-x-px | inset-inline: 1px |
inset-x-full | inset-inline: calc(var(--spacing) * 0); |
inset-y-<number> | inset-block: calc(var(--spacing) * <number>); |
inset-y-<fraction> | inset-block: calc(<fraction> * 100%); |
inset-y-full | inset-block: 100%; |
inset-y-px | inset-block: 1px |
start-<number> | inset-inline-start: calc(var(--spacing) * <number>); |
start-<fraction> | inset-inline-start: calc(<fraction> * 100%) |
start-full | inset-inline-start: 100%; |
start-px | inset-inline-start: 1px; |
end-<number> | inset-inline-end: calc(var(--spacing) * <number>); |
end-<fraction> | inset-inline-end: calc(<fraction> * 100%) |
end-full | inset-inline-end: 100%; |
end-px | inset-inline-end: 1px; |
top-<number> | top: calc(var(--spacing) * <number>); |
top-<fraction> | top: calc(<fraction> * 100%); |
top-full | top: 100%; |
top-px | top: 1px; |
right-<number> | right: calc(var(--spacing) * <number>); |
right-<fraction> | right: calc(<fraction> * 100%); |
right-full | right: 100%; |
right-px | right: 1px; |
bottom-<number> | bottom: calc(var(--spacing) * <number>); |
bottom-<fraction> | bottom:calc(<fraction> * 100%); |
bottom-full | bottom: 100%; |
bottom-px | bottom: 1px; |
left-<number> | left: calc(var(--spacing) * <number>); |
left-<fraction> | left: calc(<fraction> * 100%); |
left-full | left: 100%; |
left-px | left: 1px; |
inset-(<custom-property>) | inset: var(<custom-property>); |
inset-[<value>] | inset: <value>; |
Use the top-*
, right-*
, bottom-*
, left-*
, and inset-*
utilities to set the horizontal or vertical position of a positioned element:
To use a negative top/right/bottom/left value, prefix the class name with a dash to convert it to a negative value:
Use the start-*
and end-*
utilities to set the inset-inline-start
and inset-inline-end
logical properties, which map to either the left or right side based on the text direction:
For more control, you can also use the LTR and RTL modifiers to conditionally apply specific styles depending on the current text direction.
Use the inset-(<custom-property>)
syntax to set the inset based on a custom property:
<div class="inset-(--my-inset) ..."> <!-- ... --></div>
Use the inset-[<value>]
syntax to set the inset based on a completely custom value:
<div class="inset-[3px] ..."> <!-- ... --></div>
Prefix an inset
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<div class="top-4 md:top-6"> <!-- ... --></div>
Learn more about using variants in the variants documentation.
Use the --inset-*
theme variables to customize the inset utilities in your project:
@theme { --inset-3px: 3px; }
Now the inset-3px
utility can be used in your markup:
<div class="inset-3px"> <!-- ... --></div>
Learn more about customizing your theme in the theme documentation.