propriedade HTML DOM Estilo ListStyle
Definição e Uso
propriedade estenográfica ListStyle para definir ou retornar uma lista de três propriedades independentes.
Com esta propriedade, você pode definir / retorno:
- list-style-type
- list-style-position
- list-style-image
gramática
Definindo as propriedades ListStyle:
Object.style.listStyle="type position image"
Propriedades volta ListStyle:
Object.style.listStyle
Dica: O atributo ListStyle valor padrão é "disco de nenhum lado de fora".
参数 | 描述 |
---|---|
type | 定义列表项标记的类型。 |
position | 对列表项标记进行定位。 |
image | 定义图像为列表项标记。 |
inherit | listStyle 属性的值从父元素继承。 |
Suporte a navegadores
Todos os principais navegadores suportam propriedade ListStyle.
Nota: IE7 e versões anteriores não suportam o valor "herdar".IE8 só fornece! DOCTYPE suportado "herdar". suporte IE9 "herdar".
Exemplos
Exemplos
Mude o estilo da lista:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("ul1").style.listStyle="decimal inside";
}
</script>
</head>
<body>
<ul id="ul1">
<li>Coffee</li>
<li>Tea</li>
<li>Water</li>
<li>Soda</li>
</ul>
<br>
<button type="button" onclick="displayResult()">修改列表style</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
document.getElementById("ul1").style.listStyle="decimal inside";
}
</script>
</head>
<body>
<ul id="ul1">
<li>Coffee</li>
<li>Tea</li>
<li>Water</li>
<li>Soda</li>
</ul>
<br>
<button type="button" onclick="displayResult()">修改列表style</button>
</body>
</html>
tente »
estilo Objects