propriedade HTML DOM Estilo letterSpacing
Definição e Uso
letterSpacing propriedade define ou retorna o espaço entre os caracteres no texto.
gramática
Definindo as propriedades letterSpacing:
Object.style.letterSpacing="normal|length|inherit"
Voltar letterSpacing propriedades:
Object.style.letterSpacing
值 | 描述 |
---|---|
normal | 默认。定义字符间的标准空间。 |
length | 使用 px、cm 等单位定义字符间的空间。可使用负值。 |
inherit | letterSpacing 属性的值从父元素继承。 |
Suporte a navegadores
Todos os principais navegadores suportam letterSpacing propriedade.
Nota: IE7 e versões anteriores não suportam o valor "herdar".IE8 só fornece! DOCTYPE suportado "herdar". suporte IE9 "herdar".
Exemplos
Exemplos
Alterar o espaço entre os caracteres:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.letterSpacing="15px";
}
</script>
</head>
<body>
<p id="p1">这是一些文本。</p>
<br>
<button type="button" onclick="displayResult()">修改字符间间距</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("p1").style.letterSpacing="15px";
}
</script>
</head>
<body>
<p id="p1">这是一些文本。</p>
<br>
<button type="button" onclick="displayResult()">修改字符间间距</button>
</body>
</html>
tente »
estilo Objects