Javascript DOM CSS Style outlineWidth Property set

Introduction

Change the width of the outline of a <div> element, using the "thick" value:

document.getElementById("myDiv").style.outlineWidth = "thick";

View in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myDiv {//w ww  . java2  s . co  m
  border: 1px solid red;
  outline: thin solid green;
}
</style>
</head>
<body>

<div id="myDiv">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Change outline width</button>

<script>
function myFunction() {
  document.getElementById("myDiv").style.outlineWidth = "thick";
}
</script>

</body>
</html>



PreviousNext

Related