Javascript DOM CSS Style borderLeftStyle Property

Introduction

Add a "solid" left border to a <div> element:

document.getElementById("myDiv").style.borderLeftStyle = "solid";

View in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Set solid left border</button>

<script>
function myFunction() {/*  w  ww .  ja  va  2 s .  co  m*/
  document.getElementById("myDiv").style.borderLeftStyle = "solid";
}
</script>

</body>
</html>

The borderLeftStyle property sets or gets the style of the left border of an element.

Property Values

Value Description
noneDefines no border. default
hidden Same as "none"
dotted a dotted border
dashed a dashed border
solid a solid border
double two borders.
groove a 3D grooved border.
ridge a 3D ridged border.
inset a 3D inset border.
outset a 3D outset border.
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

The borderLeftStyle property returns a String representing the style of an element's left border.




PreviousNext

Related