Javascript examples for CSS Style Property:wordSpacing
The wordSpacing property sets or gets the spacing between words in a text.
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. |
Item | Value |
---|---|
Default Value: | normal? |
Return Value: | A String, representing the space between words in the text |
CSS Version | CSS1 |
Set the space between words in a <p> element to 50 pixels:
<!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>