CSS Properties
CSS border-block-end-color Property
Photo Credit to CodeToFun
🙋 Introduction
The border-block-end-color
property in CSS is used to set the color of an element's block-end border. In languages written from top to bottom, like English, the block-end corresponds to the bottom edge of the element.
This property is part of the logical properties module, which allows you to control layout properties in a way that adapts to different writing modes, such as right-to-left or vertical text.
💡 Syntax
The syntax for the border-block-end-color
property is simple and similar to other border color properties.
element {
border-block-end-color: color;
}
Here, color can be a named color, a hexadecimal value, an RGB value, an HSL value, or any other valid CSS color value.
🎛️ Default Value
The default value of the border-block-end-color
property is currentcolor, which means it inherits the value of the element's color property.
🏠 Property Values
Value | Description |
---|---|
named-color | A color keyword, such as black, white, red, etc. |
hexadecimal value | A hex code representing a color, such as #000000 (black). |
RGB value | An RGB color value, such as rgb(0, 0, 0) (black). |
HSL value | An HSL color value, such as hsl(0, 0%, 0%) (black). |
currentcolor | Uses the current value of the color property. |
📄 Example
In this example, we'll set the block-end border color of a div element to red.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS border-block-end-color Example</title>
<style>
div {
border-block-end-style: solid;
border-block-end-width: 4px;
border-block-end-color: red;
}
</style>
</head>
<body>
<h1>Block-End Border with Custom Color</h1>
<div>This div has a red block-end border.</div>
</body>
</html>
🖥️ Browser Compatibility
The border-block-end-color
property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. It is part of the CSS Logical Properties and Values Module, which is well-supported across these browsers. However, testing across different browsers is recommended to ensure consistent behavior.
🎉 Conclusion
The border-block-end-color
property provides a flexible way to control the color of an element's block-end border, adapting to different writing modes and layouts. It is a useful addition to CSS, especially when building multilingual websites or layouts that need to support various text directions. Experiment with different colors and see how this property can enhance your design.
👨💻 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 border-block-end-color Property), please comment here. I will help you immediately.