CSS border-inline-start-style Property
This property defines the line style for the logical start border of an element, adapting to the document's writing mode.
| none | No border is displayed, and the border width is forced to zero. |
| hidden | Same as none, but used to resolve border conflicts in table elements. |
| dotted | The border is a series of small, round dots. |
| dashed | The border is a series of short line segments. |
| solid | The border is a single, continuous solid line. |
| double | The border is two parallel solid lines with some space between them. |
| groove | The border looks as though it is carved into the page. |
| ridge | The border looks like it is coming out of the page, the opposite of groove. |
| inset | The border makes the element look like it is embedded in the page. |
| outset | The border makes the element look like it is embossed or popping out. |
Code Examples
A basic example showing a dashed border on the logical start side of a div.
<div style="border-inline-start-style: dashed; border-inline-start-width: 5px; border-inline-start-color: #ff0000; padding: 10px;">This box has a dashed logical start border.</div>An advanced example using JavaScript to toggle text direction, demonstrating how the logical border style moves and changes dynamically.
<div id="contentBox" style="border-inline-start-style: solid; border-inline-start-width: 10px; border-inline-start-color: #007bff; padding: 20px; direction: ltr;">Observe how the border moves when the direction changes.</div>
<button onclick="toggleDirection()">Toggle Direction</button>
<script>
function toggleDirection() {
const el = document.getElementById("contentBox");
const isLtr = el.style.direction === "ltr";
el.style.direction = isLtr ? "rtl" : "ltr";
el.style.borderInlineStartStyle = isLtr ? "double" : "solid";
}
</script>Pro Tip
You can use the shorthand border-inline-start to set the width, style, and color in a single line. It keeps your style sheets lean and easier to read for the next developer who has to touch your code.
Deep Dive
Think of border-inline-start-style as a smart version of border-left-style. In a standard English layout (Left-to-Right), the inline-start is the left side. However, if you switch to a Right-to-Left language like Arabic, the start of the line is now on the right. This logical property automatically flips the border style to the correct side based on the writing direction. It functions within the inline axis, which is the direction in which text flows in a line. It requires a border-width to be visible, as the default width is often effectively zero if not initialized properly.
Best Practices
Use logical properties like this one instead of physical properties like border-left or border-right to make your layouts future-proof and internationally friendly. It prevents the need to write custom CSS overrides for different language directions. Always pair this with border-inline-start-width and border-inline-start-color for predictable results.
Common Pitfalls
The most common mistake is forgetting that this property only handles the style. If you haven't set a width, the border won't show up because the default is 0. Also, beginners often confuse inline with block; inline refers to the text flow direction, while block refers to the stacking direction of paragraphs.
Accessibility
Borders are vital visual landmarks. If you use subtle styles like dotted or dashed, ensure the color contrast is high enough so users with visual impairments can distinguish the element boundaries. Avoid using the style alone to convey meaning, as some users might not perceive the difference between a solid and a double line.
Dev Data Table: border-inline-start-style property
| default | none |
| animatable | no |
| inherited | no |
| experimental | no |
| year_intro | 2014 |
| year_standard | 2021 |
| js_syntax_1 | element.style.borderInlineStartStyle = "dashed"; |
| js_syntax_2 | element.style.setProperty("border-inline-start-style", "dotted"); |
| js_note | When manipulating this property via JavaScript, remember that the property name is camelCased and the value must be a string. |
| browsers | { "Chrome": 69, "Edge": 79, "Firefox": 41, "Safari": 12.1, "Opera": 56, "Chrome Android": 69, "Safari on iOS": 12.2, "Samsung Internet": 10.1, "Opera Mobile": 48 } |