CSS justify-items Property

❮ Previous Reference Next ❯

Example

.grid-container {
  display: grid;
  grid-template-columns: auto auto auto;
  justify-items: center;
}





1
2
3
4
5
6

Meaning

The CSS justify-items property defines the default justify-self for all items of the box, giving them all a default way of justifying each box along the appropriate axis.

Default value:legacy
Inherited:No
Animatable:discrete
Version:CSS3
JavaScript syntax:
object.style.justifySelf="auto | normal | stretch | baseline-position | overflow-position ? [ self-position | left | right ] legacy";



Standard Syntax

justify-items: auto | normal | stretch | baseline-position | overflow-position ? [ self-position | left | right ] | legacy;



Browser Support




Status







Property Values

The following table describes the values of this property.

Value Description
auto Behaves as normal if the box has no parent, or when determining the actual position of an absolutely positioned box. It behaves as the computed justify-items value of the parent box (minus any legacy keywords) otherwise (including when determining the static position of an absolutely positioned box).
normal Represents the “default” alignment for the layout mode. Its behavior depends on the layout mode, as described below.
start The items is packed flush to each other toward the start edge of the alignment container in the appropriate axis.
end The items is packed flush to each other toward the end edge of the alignment container in the appropriate axis.
flex-start The items that are not children of a flex container, this value is treated like start.
flex-end The items that are not children of a flex container, this value is treated like end.
self-start The item is packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis.
self-end The item is packed flush to the edge of the alignment container of the end side of the item, in the appropriate axis.
center The items are packed flush to each other toward the center of the alignment container.
left The items are packed flush to each other toward the left edge of the alignment container. If the property's axis is not parallel with the inline axis, this value behaves like start.
right The items are packed flush to each other toward the right edge of the alignment container in the appropriate axis. If the property's axis is not parallel with the inline axis, this value behaves like start.
baseline, first baseline, last baseline Specifies participation in first- or last-baseline alignment: aligns the alignment baseline of the box's first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. The fallback alignment for first baseline is start, the one for last baseline is end.
stretch When the box’s computed width/height (as appropriate to the axis) is auto and neither of its margins (in the appropriate axis) are auto, sets the box’s used size to the length necessary to make its outer size as close to filling the alignment container as possible while still respecting the constraints imposed by min-height/min-width/max-height/max-width.
safe If the size of the alignment subject overflows the alignment container, the alignment subject is instead aligned as if the alignment mode were start.
unsafe Regardless of the relative sizes of the alignment subject and alignment container, the given alignment value is honored.
legacy Makes the value inherited by the box descendants.
Note - If a descendant has a justify-self: auto value, the legacy keyword is not considered by the descend, only the left, right, or center value associated to it.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-delay property.
revert Reverts the cascaded value of the property from its current value to the value the property
revert-layer Rollback styles to the ones specified in previous cascade layers.
unset Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.



Default CSS Property Values

selectors {
  justify-items: legacy;
}
❮ Previous Reference Next ❯