Difference between the letterSpacing property and the wordSpacing property: - Javascript CSS Style Property

Javascript examples for CSS Style Property:letterSpacing

Description

Difference between the letterSpacing property and the wordSpacing property:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<button type="button" onclick="changeLetters()">Set letter spacing</button>
<button type="button" onclick="changeWords()">Set word spacing</button>

<script>
function changeLetters() {//from ww  w. j av a2s. co  m
    document.getElementById("myP1").style.letterSpacing = "15px";
}

function changeWords() {
    document.getElementById("myP2").style.wordSpacing = "15px";
}
</script>

</body>
</html>

Related Tutorials