letterSpacing style property
Specifies or returns the amount of space between letters.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
CSS page for this property: letter-spacing |
Possible values:
The type of this property is string.
One of the following values:
Takes the value of this property from the computed style of the parent element. | |||||||
Default. Normal spacing is used. | |||||||
The space between letters in length units. For the supported length units, see the length page. |
Default: normal.
Example HTML code 1:
This example illustrates the use of the letter-spacing property:
|
||||
<head> <style> .example { letter-spacing: 10px; } </style> </head> <body> <div class="example">letter-spacing: 10px</div> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the letterSpacing property in JavaScript:
|
||||
<head> <script type="text/javascript"> function ChangeLetterSpacing () { var div = document.getElementById ("myDiv"); var input = document.getElementById ("myInput"); div.style.letterSpacing = input.value; } </script> </head> <body> <div id="myDiv">sample text to change</div> <input id="myInput" type="text" value="40" /> <button onclick="ChangeLetterSpacing ();">Change the letter-spacing of the div!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
CSSStyleDeclaration, htmlElement.currentStyle, htmlElement.runtimeStyle, htmlElement.style
HTML elements:
a, abbr, acronym, address, b, basefont, bdo, big, blink, blockquote, body, button, caption, center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, html, i, input:button, input:file, input:password, input:reset, input:search, input:submit, input:text, ins, isindex, kbd, label, legend, li, listing, marquee, menu, nobr, ol, optgroup, option, p, plaintext, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var, xmp
Related pages:
External links:
letter-spacing (MSDN)
letter-spacing (Mozilla Developer Center)
letter-spacing (Safari Reference Library)
letter-spacing (W3C)
letter-spacing (Mozilla Developer Center)
letter-spacing (Safari Reference Library)
letter-spacing (W3C)
User Contributed Comments