The borderLeftColor property allows us to set/get the color to left border of element.
Syntax:
- It is used to return the borderLeftColor property.
object.style.borderLeftColor
- It is used to set the borderLeftColor property.
object.style.borderLeftColor = "color|transparent|initial|
inherit"
Return Value:The borderLeftColor property returns the color of the left border of an element.
Property Values:
1. color: It specifies the border color of corresponding element. Black is default color.
Syntax:
borderLeftColor = "red"
Example:
HTML
<!DOCTYPE html>
< html >
< head >
< style >
#GFG_Div {
width: 200px;
margin-left: 210px;
border: thick solid green;
}
</ style >
</ head >
< body align = "center" >
< p >
Click to change the left border
color of element.
</ p >
< button type = "button" onclick = "myGeeks()" >
Click to change
</ button >
< br >< br >
< div id = "GFG_Div" >GeeksforGeeks</ div >
< script >
function myGeeks() {
document.getElementById("GFG_Div")
.style.borderLeftColor = "red";
}
</ script >
</ body >
</ html >
|
Output:


Syntax:
borderLeftColor = "yellow"
Example:
HTML
<!DOCTYPE html>
< html >
< head >
< style >
#GFG_Div {
width: 200px;
margin-left: 210px;
border: thick solid green;
}
</ style >
</ head >
< body align = "center" >
< p >
Click to change the left border
color of element.
</ p >
< button type = "button" onclick = "myGeeks()" >
Click to change
</ button >
< br >< br >
< div id = "GFG_Div" >GeeksforGeeks</ div >
< script >
function myGeeks() {
document.getElementById("GFG_Div")
.style.borderLeftColor = "yellow";
}
</ script >
</ body >
</ html >
|
Output:


2. transparent: It sets the border color of corresponding element to transparent.
Syntax:
borderLeftColor = "transparent"
Example:
HTML
<!DOCTYPE html>
< html >
< head >
< style >
#GFG_Div {
width: 200px;
margin-left: 210px;
border: thick solid green;
}
</ style >
</ head >
< body align = "center" >
< p >
Click to change the left border
color of element.
</ p >
< button type = "button" onclick = "myGeeks()" >
Click to change
</ button >
< br >< br >
< div id = "GFG_Div" >GeeksforGeeks</ div >
< script >
function myGeeks() {
document.getElementById("GFG_Div")
.style.borderLeftColor = "transparent";
}
</ script >
</ body >
</ html >
|
Output:


3. initial:When no value specified for this field, it is inherited from the parent of element. If there is no parent means this element is root then it takes initial(or default) value.
4. inherit:This keyword applies the initial(or default) value of a property to an element. The initial value should not be confused by the value specified by the browser’s style sheet. When borderColor sets to initial, It appears black(default) color.
Browser Support: The browser supported by DOM Style borderLeftColor property are listed below:
- Google Chrome 1
- Edge 12
- Internet Explorer 4
- Mozilla firefox 1
- Opera 3.5
- Safari 1
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!