CSS Properties
CSS inset-inline-end Property
Photo Credit to CodeToFun
🙋 Introduction
The inset-inline-end
property in CSS is a logical property that defines the offset of an element's end edge in the inline direction within its containing block. Logical properties and values are writing-mode-aware, meaning they can adapt to different writing directions, such as left-to-right (LTR) and right-to-left (RTL).
This property is part of the CSS Logical Properties and Values Level 1 specification, which aims to provide more flexibility in styling for internationalization and different writing modes.
💡 Syntax
The syntax for the inset-inline-end
property is as follows:
element {
inset-inline-end: length | auto | initial | inherit;
}
🎛️ Default Value
The default value of the inset-inline-end
property is auto.
🏠 Property Values
Value | Description |
---|---|
length | Specifies a fixed offset from the end edge. Can be any valid length value (e.g., px, em, rem). |
auto | The browser calculates the offset. |
initial | Sets the property to its default value. |
inherit | Inherits the value from its parent element. |
📄 Example
In this example, we'll set the inset-inline-end
property of a positioned element to 20px to offset it 20 pixels from the end edge in the inline direction.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS inset-inline-end Example</title>
<style>
.box {
position: absolute;
inset-inline-end: 20px;
top: 50px;
width: 100px;
height: 100px;
background-color: lightcoral;
}
</style>
</head>
<body>
<h1>Element with Custom Inset-inline-end</h1>
<div class="box"></div>
</body>
</html>
🖥️ Browser Compatibility
The inset-inline-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-inline-end
property is a useful tool for web developers looking to create layouts that adapt to different writing modes and directions.
By using logical properties, you can ensure your designs are more flexible and better suited for internationalization. Experiment with this property to see how it 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-inline-end Property), please comment here. I will help you immediately.