HTML DOM propiedad Estilo ListStyle
Definición y Uso
ListStyle propiedad abreviada para establecer o devolver una lista de tres propiedades independientes.
Con esta propiedad, se puede establecer / retorno:
- list-style-type
- list-style-position
- list-style-image
gramática
Configuración de las propiedades ListStyle:
Object.style.listStyle="type position image"
Volver propiedades ListStyle:
Object.style.listStyle
Consejo: El atributo ListStyle valor por defecto es "disco fuera de ninguno".
参数 | 描述 |
---|---|
type | 定义列表项标记的类型。 |
position | 对列表项标记进行定位。 |
image | 定义图像为列表项标记。 |
inherit | listStyle 属性的值从父元素继承。 |
Soporte para el navegador
Todos los principales navegadores soportan la propiedad ListStyle.
Nota: Internet Explorer 7 y versiones anteriores no son compatibles con el valor "heredar".IE8 sólo proporciona! DOCTYPE apoyado "hereda". apoyo IE9 "hereda".
Ejemplos
Ejemplos
Cambiar el estilo de la 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>
Trate »
Objetos de estilo