Front-end Tutorials

Front-end Tutorials

HTMLCSSSassJavaScriptReactJS
CMS Tutorials

CMS Tutorials

WordPress
Tutorials expand

CSS Topics

CSS border-left-color Property

Posted in CSS Tutorial
Updated on Oct 02, 2024
By Mari Selvan
👁️ 20 - Views
⏳ 4 mins
💬 1 Comment
CSS border-left-color Property

Photo Credit to CodeToFun

🙋 Introduction

The border-left-color property in CSS allows you to specify the color of the left border of an element.

This property is useful when you want to individually style the left border of an element without affecting the other borders. It is often used in conjunction with other border properties to create a custom look for your web elements.

💡 Syntax

The syntax for the border-left-color property is simple. You apply it directly to an element, specifying a color value.

Syntax
Copied
Copy To Clipboard
element {
  border-left-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 for the border-left-color property is the color of the element's text (currentcolor). If not specified, it inherits the color of the element's color property.

🏠 Property Values

ValueDescription
named-colorA color keyword, such as blue, red, green, etc.
hexadecimal valueA hex code representing a color, such as #ff5733.
RGB valueAn RGB color value, such as rgb(255, 87, 51).
HSL valueAn HSL color value, such as hsl(9, 100%, 60%).
transparentThe border will be transparent, meaning it will not be visible.

📄 Example

In this example, we'll change the left border color of a div element to red.

index.html
Copied
Copy To Clipboard
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CSS border-left-color Example</title>
  <style>
    div {
      border: 5px solid black;
      border-left-color: red;
      padding: 10px;
    }
  </style>
</head>
<body>
  <h1>Div with Custom Left Border Color</h1>
  <div>
    This is a div with a red left border.
  </div>
</body>
</html>

🖥️ Browser Compatibility

The border-left-color property is widely supported across all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is also supported in older browsers, making it a reliable choice for styling your web elements.

🎉 Conclusion

The border-left-color property is a versatile tool for customizing the appearance of an element's left border. By specifying a different color for the left border, you can add a unique visual element to your design. Combine this property with other border properties to achieve the desired effect and enhance the overall look of your web pages.

👨‍💻 Join our Community:

To get interesting news and instant updates on Front-End, Back-End, CMS and other Frameworks. Please Join the Telegram Channel:

Author

author
👋 Hey, I'm Mari Selvan

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

Share Your Findings to All

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
We make use of cookies to improve our user experience. By using this website, you agree with our Cookies Policy
AgreeCookie Policy