Change the style of a list:
document.getElementById("myList").style.listStyle = "decimal inside";
Try it Yourself »
The listStyle property sets or returns up to three separate list properties, in a shorthand form.
With this property, you can set/return one or more of the following (in any order):
Property | |||||
---|---|---|---|---|---|
listStyle | Yes | Yes | Yes | Yes | Yes |
Return the listStyle property:
object.style.listStyle
Set the listStyle property:
object.style.listStyle
= "type position image|initial|inherit"
Parameter | Description |
---|---|
type | Defines the list-item marker type |
position | Positions the list-item marker |
image | Defines an image to be used as the list-item marker |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | disc outside none |
---|---|
Return Value: | A String, representing the style of a list |
CSS Version | CSS1 |
Change the type and position of a list to "square inside":
document.getElementById("myList").style.listStyle = "square inside";
Try it Yourself »
CSS tutorial: CSS List
CSS reference: list-style property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!