wordSpacing Property - Javascript CSS Style Property

Javascript examples for CSS Style Property:wordSpacing

Description

The wordSpacing property sets or gets the spacing between words in a text.

Property Values

Value Description
normal Defines normal spacing between words. This is default
length Specifies the space between words in length units. Negative values are allowed
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Technical Details

Item Value
Default Value: normal?
Return Value: A String, representing the space between words in the text
CSS VersionCSS1

Set the space between words in a <p> element to 50 pixels:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP" style="word-spacing:10px;">This is an example paragraph.</p>

<button type="button" onclick="myFunction()">Return word spacing of p</button>

<script>
function myFunction() {/*from   www  .jav a  2  s . c o m*/
    document.getElementById("myP").style.wordSpacing = '50px';
}
</script>

</body>
</html>

Related Tutorials