The DOM style borderLeft property is used to set or return the three different border-left properties such as border-left-width, border-left-style, and border-left-color of an element.
Syntax:
- It is used to return the borderLeft Property.
object.style.borderLeft
- It is used to set the borderLeft property.
object.style.borderLeft = "width style color|initial|inherit"
Property value:
- width: This will set the width of the left border.
- style: This will set the style of the left border.
- color: This will set the color of the left border.
- initial: This will set the property to its default value.
- inherit: This will inherit the property from its parent element
Return Value: It returns a string value that represents the width, style, and/or color of the left border of an element.
Example 1: In this example, we will see the use of borderLeft property
HTML
<!DOCTYPE html>
< html >
< head >
< title >
DOM Style borderLeft Property
</ title >
</ head >
< body >
< center >
< h1 style = "color:green;width:50%;" id = "sudo" >
GeeksForGeeks
</ h1 >
< h2 >DOM Style borderLeft Property </ h2 >< br >
< button type = "button" onclick = "geeks()" >
Submit
</ button >
< script >
function geeks() {
document.getElementById("sudo").style.borderLeft
= "thick solid green";
}
</ script >
</ center >
</ body >
</ html >
|
Output:
Example 2: In this example, we will see the use of borderLeft property
HTML
<!DOCTYPE html>
< html >
< head >
< title >
DOM Style borderLeft Property
</ title >
</ head >
< body >
< center >
< h1 style = "color:green;" >
GeeksForGeeks
</ h1 >
< h2 >DOM Style borderLeft Property </ h2 >
< h3 style = "border:2px solid red;width:50%;"
id = "sudo" >
geeksforgeeks
</ h3 >
< br >
< button type = "button" onclick = "geeks()" >
Submit
</ button >
< script >
function geeks() {
document.getElementById("sudo").style.borderLeft
= "thick dotted green";
}
</ script >
</ center >
</ body >
</ html >
|
Output:
Supported Browsers: The browser supported by DOM borderLeft Property are listed below:
- Google Chrome 1
- Edge 12
- Internet Explorer 4
- Firefox 1
- Opera 3.5
- Apple Safari 1