Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • HTML Tutorial
  • HTML Exercises
  • HTML Tags
  • HTML Attributes
  • Global Attributes
  • Event Attributes
  • HTML Interview Questions
  • HTML DOM
  • DOM Audio/Video
  • HTML 5
  • HTML Examples
  • Color Picker
  • A to Z Guide
  • HTML Formatter
Open In App

HTML DOM Style borderLeft Property

Last Updated : 27 Feb, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

HTML DOM Style borderLeft property allows manipulation of the left border style of an element via JavaScript. It controls the border's width, style, and color, affecting the element's visual presentation and layout.

HTML DOM Style borderLeft Property Syntax:

  • Get the borderLeft Property.
object.style.borderLeft
  • Set the borderLeft property.
object.style.borderLeft = "width style color|initial|inherit"

Property Values:

  • 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

Note: HTML DOM Style borderLeft Property is shorthand for border-left-width, border-left-style, and border-left-color

HTML DOM Style borderLeft Property Example:

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%;                     border: 1px solid;"                     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: 


borderLeft
HTML DOM Style borderLeft Property

Explanation

  • Here Header styled with green color and a thin solid border.
  • JavaScript function modifies left border to thick solid green.
  • Demonstrates DOM Style borderLeft property.

HTML DOM Style borderLeft Property Example:

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:1px solid green;width:50%;"              id="sudo">               geeksforgeeks           </h3>           <h3 style="border:2px solid skyblue;width:50%;"            id="sudo2">             geeksforgeeks         </h3>         <h3 style="border:2px solid orange;width:50%;"          id="sudo3">           geeksforgeeks       </h3>         <br>         <button type="button" onclick="geeks()">             Submit         </button>                <script>             function geeks() {                 document.getElementById("sudo").style.borderLeft                     = "thick dotted green";                 document.getElementById("sudo2").style.borderLeft                     = "thick solid blue";                 document.getElementById("sudo3").style.borderLeft                     = "10px solid red";             }         </script>     </center> </body>    </html> 

Output: 

borderLeftProperty
HTML DOM Style borderLeft Property

Explanation

  • In the above example we have three <h3> elements are styled with different border colors and widths.
  • JavaScript function geeks() is triggered on button click.
  • In geeks() function, the left border of each <h3> element is modified using DOM Style borderLeft property.
  • This demonstrates the dynamic application of the DOM Style borderLeft property.

Supported Browsers: The browser supported by HTML DOM borderLeft Property are listed below:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 4
  • Firefox 1
  • Opera 3.5
  • Apple Safari 1

M

manaschhabra2
Improve
Article Tags :
  • Misc
  • Web Technologies
  • HTML
  • Web technologies
  • HTML-DOM
Practice Tags :
  • Misc

Similar Reads

    HTML DOM focus() Method
    DOM focus() method is used to give focus to an element and also to remove the focus with the help of blur() method. We can apply focus to any element and enable it by doing some operation. For example, we can give focus to some text by clicking a button. Syntax: Object.focus() Example-1: HTML <!D
    1 min read
    HTML DOM innerHTML Property
    The innerHTML property sets or returns the HTML content (inner HTML) of an element. It allows you to manipulate the inner content, including HTML tags, by assigning new HTML strings or retrieving existing content, making it useful for dynamic updates on web pages.SyntaxIt returns the innerHTML Prope
    2 min read
    HTML DOM firstChild Property
    The DOM firstChild Property is used to return the firstchild Node of its parent node element. It is read-only property and may return an element node, a text node or a comment node. Syntax:node.firstChild Return Value: It returns a string value which represent the first child of a node. If the eleme
    2 min read
    HTML DOM parentNode Property
    The parentNode property is used to return the parent node of the specified node as a Node object. It is a read-only property. Syntax: node.parentNode Return value: This property returns a parent element of the specified node or null if the current node has no parent element. Example: In this example
    2 min read
    HTML | DOM Abbreviation Object
    The DOM Abbreviation Object is used to represent the HTML <abbr> element. The abbreviation element is accessed by getElementById(). Example 1: html <!DOCTYPE html> <html> <head> <title> HTML DOM Abbreviation Object </title> <script> function myGeeks() { var
    1 min read
    HTML | DOM Style margin Property
    The DOM Style margin Property is used to sets or returns the margin of an element.We can set the different size of margins for individual sides(top, right, bottom, left).Margin properties can have following values: Length in cm, px, pt, etc.Width % of the element.Margin calculated by the browser: au
    2 min read
    HTML DOM nodeName Property
    The nodeName property is used to return the name of the specified node as a string. It returns different values for different nodes such as if the node attributes, then the returned string is the attribute name, or if the node is an element, then the returned string is the tag name. It is a read-onl
    2 min read
    HTML DOM textContent Property
    The textContent property in HTML is used to set or return the text content of the specified node and all its descendants. This property is very similar to nodeValue property but this property returns the text of all child nodes.Syntax: It is used to set the text of node. node.textContent = textIt is
    2 min read
    HTML ondrop Event Attribute
    The ondrop event attribute is used to drag an element or text and drop it into a valid droppable location or target. The drag and drop is a common feature of HTML 5. There are different events that are used and occur before ondrop event. Events occur on the draggable targetEvents occur on the drop t
    3 min read
    HTML DOM item() Method
    The item() method is used to return the node at the specified index. The nodes are sorted as they appear in the source code. The index of the node list starts with 0. Syntax:nodelist.item( index )ornodelist[ index ] Parameters: This method accepts single parameter index which is used to hold the ind
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences