CSS Properties
CSS inset-block-end Property
Photo Credit to CodeToFun
๐ Introduction
The inset-block-end
property in CSS is a logical property that allows you to control the offset of an element's block-end edge in a flow-relative manner.
This property is part of the Logical Properties and Values specification, which provides a way to write CSS that is adaptable to different writing modes, such as left-to-right, right-to-left, and vertical text layouts.
๐ก Syntax
The syntax for the inset-block-end
property is straightforward. You can specify a length, percentage, or auto value.
element {
inset-block-end: value;
}
๐๏ธ Default Value
The default value of the inset-block-end
property is auto, which means the element's block-end offset will be determined by the browser's default styling.
๐ Property Values
Value | Description |
---|---|
length | Specifies a fixed offset. Can be in units like px, em, rem, etc. |
percentage | Specifies an offset as a percentage of the containing block's block size. |
auto | The browser calculates the block-end offset automatically. |
๐ Example
In this example, we'll set the inset-block-end
property to 20px for a div element.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS inset-block-end Example</title>
<style>
.box {
position: relative;
inset-block-end: 20px;
width: 100px;
height: 100px;
background-color: lightcoral;
}
</style>
</head>
<body>
<h1>Div with Custom Block-End Offset</h1>
<div class="box"></div>
</body>
</html>
๐ฅ๏ธ Browser Compatibility
The inset-block-end
property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always a good practice to test your website across different browsers to ensure compatibility.
๐ Conclusion
The inset-block-end
property is a useful tool for web developers looking to create layouts that are adaptable to different writing modes.
By using this logical property, you can ensure that your designs are more flexible and better suited for internationalization. Experiment with different values and see how this property can enhance the responsiveness and adaptability of your web projects.
๐จโ๐ป Join our Community:
Author
For over eight years, I worked as a full-stack web developer. Now, I have chosen my profession as a full-time blogger at codetofun.com.
Buy me a coffee to make codetofun.com free for everyone.
Buy me a Coffee
If you have any doubts regarding this article (CSS inset-block-end Property), please comment here. I will help you immediately.