HTML | DOM Style borderLeftWidth Property
The DOM Style borderLeftWidth property is used to set or return the width of the left border of an element.
Syntax:
- To get the borderLeftWidth Property
object.style.borderLeftWidth
- To set the borderLeftWidth Property
object.style.borderLeftWidth = "thin | medium | thick | length | initial | inherit"
Property Values:
- thin: This is used to define a thin left border.
Example-1:
<!DOCTYPE html><htmllang="en"><head><title>DOM Style BorderLeftWidth</title><style>.elem {padding: 10px;border-style: solid;}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style BorderLeftWidth</b><pclass="elem">GeeksforGeeks is a computer scienceportal with a huge variety of well written andexplained computer science and programmingarticles, quizzes and interview questions.</p><buttononclick="changeWidth()">Change BorderLeftWidth</button><!-- Script to change BorderLeftWidth --><script>function changeWidth() {elem = document.querySelector('.elem');elem.style.borderLeftWidth = 'thin';}</script></body></html>chevron_rightfilter_noneOutput:
Before clicking the button:

After clicking the button:

- medium: This is used to define a medium left border. This is the default value.
Example-2:
<!DOCTYPE html><htmllang="en"><head><title>DOM Style BorderLeftWidth</title><style>.elem {padding: 10px;border-style: solid;border-left-width: thin;}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style BorderLeftWidth</b><pclass="elem">GeeksforGeeks is a computer scienceportal with a huge variety of wellwritten and explained computerscience and programming articles,quizzes and interview questions.</p><buttononclick="changeWidth()">Change BorderLeftWidth</button><!-- Script to change BorderLeftWidth --><script>function changeWidth() {elem = document.querySelector('.elem');elem.style.borderLeftWidth = 'medium';}</script></body></html>chevron_rightfilter_noneOutput:
Before clicking the button:

After clicking the button:

- thick: This is used to define a thick left border.
Example-3:
<!DOCTYPE html><htmllang="en"><head><title>DOM Style BorderLeftWidth</title><style>.elem {padding: 10px;border-style: solid;}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style BorderLeftWidth</b><pclass="elem">GeeksforGeeks is a computer scienceportal with a huge variety of wellwritten and explained computer scienceand programming articles, quizzesand interview questions.</p><buttononclick="changeWidth()">Change BorderLeftWidth</button><!-- Script to change BorderLeftWidth --><script>function changeWidth() {elem = document.querySelector('.elem');elem.style.borderLeftWidth = 'thick';}</script></body></html>chevron_rightfilter_noneOutput:
Before clicking the button:

After clicking the button:

- length: This is used to define the left border width in terms of length units.
Example-4:
<!DOCTYPE html><htmllang="en"><head><title>DOM Style BorderLeftWidth</title><style>.elem {padding: 10px;border-style: solid;}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style BorderLeftWidth</b><pclass="elem">GeeksforGeeks is a computer science portalwith a huge variety of well written andexplained computer science and programmingarticles, quizzes and interview questions.</p><buttononclick="changeWidth()">Change BorderLeftWidth</button><!-- Script to change BorderLeftWidth --><script>function changeWidth() {elem = document.querySelector('.elem');elem.style.borderLeftWidth = '10px';}</script></body></html>chevron_rightfilter_noneOutput:
Before clicking the button:

After clicking the button:

- initial: This is used to set this property to its default value.
Example-5:
<!DOCTYPE html><htmllang="en"><head><title>DOM Style BorderLeftWidth</title><style>.elem {padding: 10px;border-style: solid;border-left-width: 15px;}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style BorderLeftWidth</b><pclass="elem">GeeksforGeeks is a computer science portalwith a huge variety of well written and explainedcomputer science and programming articles, quizzesand interview questions.</p><buttononclick="changeWidth()">Change BorderLeftWidth</button><!-- Script to change BorderLeftWidth --><script>function changeWidth() {elem = document.querySelector('.elem');elem.style.borderLeftWidth = 'initial';}</script></body></html>chevron_rightfilter_noneOutput:
Before clicking the button:

After clicking the button:

- inherit: This inherits the property from its parent.
Example-6:
<!DOCTYPE html><htmllang="en"><head><title>DOM Style BorderLeftWidth</title><style>#parent {padding: 10px;border-style: solid;border-left-width: 15px;}.elem {padding: 10px;border-style: solid;}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style BorderLeftWidth</b><br><br><divid="parent"><pclass="elem">GeeksforGeeks is a computer scienceportal with a huge variety of wellwritten and explained computer scienceand programming articles, quizzes andinterview questions.</p></div><br><buttononclick="changeWidth()">Change BorderLeftWidth</button><!-- Script to change BorderLeftWidth --><script>function changeWidth() {elem = document.querySelector('.elem');elem.style.borderLeftWidth = 'inherit';}</script></body></html>chevron_rightfilter_noneOutput:
Before clicking the button:

After clicking the button:

- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Apple Safari
- HTML | DOM Style right Property
- HTML | DOM Style top Property
- HTML | DOM Style animationTimingFunction Property
- HTML | DOM Style textDecorationStyle Property
- HTML | DOM Style cursor Property
- HTML | DOM Style animationDirection Property
- HTML | DOM Style visibility Property
- HTML | DOM Style transitionProperty Property
- HTML | DOM Style isolation Property
- HTML | DOM Style filter Property
- HTML | DOM Style clear Property
- HTML | DOM Style columnFill Property
- HTML | DOM Style objectFit Property
- HTML | DOM Style borderBottomColor Property
- HTML | DOM Style opacity Property
Supported Browsers: The browser supported by borderLeftWidth property are listed below:
Recommended Posts:
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



