CSS inset-block-start Property
Description
The inset-block-start
CSS property defines the offset or distance between the starting edge of an element's containing block and the starting edge of the element itself within the block flow. This property is particularly useful for creating flexible and responsive layouts in CSS Grid and Flexbox, allowing precise control over the positioning of elements within their parent containers. The "start" edge depends on the writing mode; for horizontal writing modes like left-to-right, it typically refers to the left edge, while for vertical writing modes, it refers to the top edge. By adjusting the inset-block-start value, web developers can control the placement of elements, making it an essential tool for creating modern and adaptable web designs.
- Initial value
- auto
- Applies to
- positioned elements
- Inherited
- no
- Computed value
- same as box offsets: top, right, bottom, left properties except that directions are logical
- Animatable
- a length, percentage or calc();
- JavaScript syntax
- object.style.insetBlockStart
Interactive Demo
Syntax
inset-block-start: auto | <length-percentage>
Values
- <length-percentage>Specifies distance in px, pt, cm, etc. Negative values are allowed.
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-start: 20px;
background-color: #c8c800;
}
Browser Support
The following table will show you the current browser support for the CSS inset-block-start
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