样式 listStyle 属性
描述
listStyle 属性以简写形式设置或返回最多三个单独的列表属性。
使用此属性,您可以设置/返回以下一个或多个(按任意顺序):
- list-style-type
- list-style-position
- list-style-image
浏览器支持
属性 | |||||
---|---|---|---|---|---|
listStyle | 是 | 是 | 是 | 是 | 是 |
语法
返回 listStyle 属性
object.style.listStyle
设置 listStyle 属性
object.style.listStyle = "type position image|initial|inherit"
属性值
参数 | 描述 |
---|---|
type | 定义列表项标记类型 |
position | 定位列表项标记 |
图片 | 定义用作列表项标记的图像 |
initial | 将此属性设置为其默认值。阅读关于 initial |
inherit | 从其父元素继承此属性。阅读关于 inherit |
技术详情
默认值 | disc outside none |
---|---|
返回值 | 字符串,表示列表的样式 |
CSS 版本 | CSS1 |
更多示例
示例
将列表的类型和位置更改为 "square inside"
document.getElementById("myList").style.listStyle = "square inside";
自己动手试一试 »
相关页面
CSS 教程: CSS 列表
CSS 参考: list-style 属性