Javascript DOM CSS Style letterSpacing Property with negative value

Introduction

Using negative values:

document.getElementById("myP").style.letterSpacing = "-2px";

View in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP">This is an example paragraph.</p>

<button type="button" onclick="myFunction()">Set letter spacing</button>

<script>
function myFunction() {//from   w w w  . j ava 2s  .c o  m
  document.getElementById("myP").style.letterSpacing = "-2px";
}
</script>

</body>
</html>



PreviousNext

Related