CSS inset-block Property
Description
The inset-block
CSS property is a shorthand property that allows you to set the top and bottom positions of an element within its containing block simultaneously. It simplifies the process of positioning an element along the block axis (vertical positioning) within a container, typically when working with block-level elements. By using this property, you can specify values for the top and bottom properties in a single declaration, making it more concise and easier to maintain your CSS code while achieving the desired layout and spacing within your web page.
- Initial value
- See individual properties
- Applies to
- positioned elements
- Inherited
- no
- Computed value
- See individual properties
- Animatable
- See individual properties
- JavaScript syntax
- object.style.insetBlock
Interactive Demo
Syntax
inset-block: <top>{1,2}
Values
- <top>{1,2}The first value represents the start edge style, and the second value represents the end edge style. If only one value is given, it applies to both the start and end edges.
Example
<div>
<p class="exampleText">Example text</p>
</div>
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-lr;
position: relative;
inset-block: 20px 50px;
background-color: #c8c800;
}
Browser Support
The following table will show you the current browser support for the CSS inset-block
property.
Desktop | |||||
87 | 87 | 63 | 73 | 14.1 |
Tablets / Mobile | |||||
87 | 63 | 62 | 14.5 | 14 | 87 |
Last updated by CSSPortal on: 2nd January 2024