Javascript DOM CSS Style wordSpacing Property with negative value

Introduction

Using negative values:

document.getElementById("myP").style.wordSpacing = -3px";

View in separate window

<!DOCTYPE html>
<html>
<body>

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

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

<script>
function myFunction() {//from   w w w .  ja v  a  2  s. c o  m
  document.getElementById("myP").style.wordSpacing = "-3px";
}
</script>

</body>
</html>



PreviousNext

Related