CSS Property: word-spacing
[this page | pdf | back links]
The CSS (CSS1) word-spacing property indicates the amount
of whitespace between words.
Valid property values
(other than inherit
and initial) are:
Value
|
Description
|
length
|
Additional space
between words as a CSS
length, can be negative
|
normal
|
(default value). Normal
space between words
|
Default Value:
|
normal
|
JavaScript syntax:
|
e.g. object.style.wordSpacing="10px"
|
Inherited:
|
Yes
|
Animatable:
|
Yes
|
EXAMPLE:
HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
div {border: 2px solid red; width: 200px; background-color: yellow}
.x1 {word-spacing: 50px;}
</style>
</head>
<body>
Element with default property<br>
<div><span>aa bb cc</span></div><br>
Propery set using HTML<br>
<div><span class="x1">aa bb cc</span></div><br>
Property set using JavaScript<br>
<div><span id="x2">aa bb cc</span></div>
<script>
document.getElementById("x2").style.wordSpacing = "50px";
</script>
</body>
</html>
|
FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedCSSPropertyWordSpacing() {
var x = document.createElement("DIV"); x.style.wordSpacing = "50px"; return (window.getComputedStyle(x, null).wordSpacing == "50px");
} |
NAVIGATION LINKS
Contents | Prev | Next | CSS Properties