CSS inset Property

❮ Previous Reference Next ❯


span {
  inset: 20px 40px 30px 10px;

Hello World!


The inset CSS property is a shorthand that corresponds to the top, right, bottom, and/or left properties.

It has the same multi-value syntax of the margin shorthand.

How to use inset property:

1. If inset property has 4 values: inset: 10px 20px 30px 40px;


Hello World!

2. If inset property has 4 values: inset: 10px 20px 30px;


Hello World!

3. If inset property has 2 values: inset: 10px 20px;


Hello World!

4. If inset property has 1 values: inset: 10px;


Hello World!

Default value:auto (auto auto auto auto)
JavaScript syntax:

Standard Syntax

inset: auto|length|%|initial|inherit|revert|revert-layer|unset;

Browser Support


Property Values

The following table describes the values of this property:

Value Description
auto This is default value. The browser calculates the inset edge position.
length Specifies the offset as a length value in px, pt, cm, em, etc. Negative length values are allowed.
%(percentage) Specifies the offset in percentage. The percentage is calculated with respect to the width of the element's containing block. Negative percentage values are allowed.
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 {
  inset: auto;
❮ Previous Reference Next ❯