borderLeft Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:borderLeft

Description

The borderLeft property sets or gets three border-left properties.

  • border-left-width
  • border-left-style
  • border-left-color

Property Values

Parameter Description
width Sets the width of the left border
style Sets the style of the left border
color Sets the color of the left border
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

Item Value
Default Value: not specified
Return Value: A String, representing the width, style and/or color of the left border of an element
CSS VersionCSS1

Get a left border of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv" style="border-left:thick solid red">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Return the width of the left border</button>

<script>
function myFunction() {/* w ww .ja  v  a  2s.c  o  m*/
    console.log(document.getElementById("myDiv").style.borderLeftWidth);
}
</script>

</body>
</html>

Related Tutorials