- Services
- Case Studies
- Technologies
- NextJs development
- Flutter development
- NodeJs development
- ReactJs development
- About
- Contact
- Tools
- Blogs
- FAQ
CSS Border-Inline Enhance Web Design with Logical Borders
Explore width, style, and color options.
Introduction
The border-inline
CSS property is a shorthand for setting inline border properties in one declaration. Introduced in September 2021, it is widely supported across most browsers and devices. This property allows you to define the inline borders of an element based on its writing mode and directionality, corresponding to border-top
and border-bottom
, or border-right
and border-left
properties, depending on the layout context. Using border-inline
simplifies your CSS code, making it more readable and maintainable, which is especially useful in responsive web design.
Specification
The border-inline
CSS property is defined in the CSS Logical Properties and Values Level 1 specification. This specification standardizes logical properties that adjust based on writing mode, directionality, and text orientation. The formal definition of border-inline
can be found in the CSS Logical Properties and Values specification under #propdef-border-inline
.
Syntax
The border-inline
CSS property allows you to define the width, style, and color of the inline borders in a single declaration.
Key Components
<border-width>
: Specifies the width of the border (e.g.,1px
,2em
,thin
,medium
,thick
).<border-style>
: Defines the style of the border (e.g.,none
,dotted
,dashed
,solid
,double
,groove
,ridge
,inset
,outset
).<color>
: Sets the color of the border (e.g.,blue
,#0000FF
,rgb(0, 0, 255)
,hsl(240, 100%, 50%)
).
Examples of Syntax
Combining Values
You can combine the values in any order:
Inherited and Global Values
inherit
: Inherits the value from the parent.initial
: Sets to the initial value (medium none currentColor
).revert
: Resets to the browser’s default styling.revert-layer
: Resets to the value for that layer.unset
: Resets to inherited or initial value.
Values
The border-inline
CSS property can be specified using a combination of values that define the width, style, and color of the inline borders.
Key Values
<border-width>
: Length values (e.g.,1px
,2em
) or keywords (thin
,medium
,thick
).<border-style>
: Styles likenone
,dotted
,dashed
,solid
,double
,groove
,ridge
,inset
,outset
.<color>
: Any valid CSS color value.
Examples of Values
Constituent Properties
The border-inline
CSS property is a shorthand for setting multiple logical inline border properties:
border-inline-color
: Sets the color of the inline borders.border-inline-style
: Defines the style of the inline borders.border-inline-width
: Specifies the width of the inline borders.
Example of Constituent Properties
Combining Constituent Properties
Formal Definition
The border-inline
CSS property is a shorthand for setting the width, style, and color of the inline borders.
Initial Value
border-inline-width
:medium
border-inline-style
:none
border-inline-color
:currentcolor
Applies To
All elements.
Inherited
Not inherited.
Computed Value
border-inline-width
: Absolute length;0
if style isnone
orhidden
.border-inline-style
: As specified.border-inline-color
: Computed color value.
Animation Type
border-inline-color
: By computed value type.border-inline-style
: Discrete.border-inline-width
: By computed value type.
Formal Syntax
Examples
Example 1: Basic Usage
Example 2: Vertical Text with Inline Border
Example 3: Inline Border with Different Styles
Example 4: Shorthand vs. Longhand Properties
Browser Compatibility
The border-inline
property is widely supported in modern browsers like Firefox, Opera, and Edge. It ensures consistent behavior across different devices and platforms.
Best Practices for Browser Compatibility
- Test Across Browsers: Always test your designs in multiple browsers.
- Use Fallbacks: Include fallbacks for older browsers.
- Stay Updated: Refer to the latest documentation.
Example of Browser Compatibility
Conclusion
The border-inline
property is a versatile tool for creating responsive web designs. Its wide support across browsers ensures consistent appearance and functionality. By understanding and using border-inline
, you can enhance the visual appeal and usability of your web projects.
See Also
- CSS Logical Properties and Values
- border-top
- border-right
- border-bottom
- border-left
- writing-mode
- direction
- text-orientation These resources will help you learn how to use logical properties and border-related properties in CSS, making it easier to create responsive and adaptive web designs.
Talk with CEO
We'll be right here with you every step of the way.
We'll be here, prepared to commence this promising collaboration.
Whether you're curious about features, warranties, or shopping policies, we provide comprehensive answers to assist you.