In daily production pages, the attribute list-style can be commonly used in list-item objects, but it is not used deeply. Generally, it is almost OK to reset the entire page by setting it to none. Maybe many people, including myself, don’t know much about the more detailed attributes of the attributelist-style-type. It is more likely that the attributes list-style and The concept of attribute list-style-type is relatively vague. It is now necessary to bring it up and learn it again, so it is organized as follows.
Yihe usage
list-style shorthand attribute sets all list attributes in one statement.
Description This attribute is a shorthand attribute that covers all other list style attributes. Since it applies to all elements with display list-item, it can only be used on li elements in normal HTML and XHTML, but in fact it can be applied to any element and is inherited by list-item elements.
Definition: A shorthand attribute used to set all attributes of a list in one declaration. This attribute is a shorthand attribute that covers Removes all other list style properties and only acts on objects with a display value equal to list-item (such as li objects).
Related: list-style-imagelist-style-positionlist-style-type
◆list-style-image
Description: Sets or retrieves the list item mark as an object Image. If the value of this attribute is none or the image at the specified URL address cannot be displayed, the list-style-type attribute will take effect.
Value:
none: Default value. Do not specify an image
url(url): Specify an image using an absolute or relative url address
Set the image as an item tag in the list:
ul { list-style-image:url("/i/arrow.gif"); list-style-type:square; }
Example
咖啡
茶
可口可乐
◆list-style-position
Description: Sets or retrieves how the list item tags as objects are arranged according to the text. If a list item's left margin (
Value:
outside: Default value. The list item mark is placed outside the text, and the surrounding text is not aligned according to the mark
inside: The list item mark is placed inside the text, and the surrounding text is aligned according to the mark
Example
Specifies inside the list Position of list item mark:
ul { list-style-position:inside; }
Example
该列表的 list-style-position 的值是 "inside":
Earl Grey Tea - 一种黑颜色的茶
Jasmine Tea - 一种神奇的“全功能”茶
Honeybush Tea - 一种令人愉快的果味茶
该列表的 list-style-position 的值是 "outside":
Earl Grey Tea - 一种黑颜色的茶
Jasmine Tea - 一种神奇的“全功能”茶
Honeybush Tea - 一种令人愉快的果味茶
Browser support
All browsers support the list-style-position attribute.
Note: The attribute value "inherit" is not supported by any version of Internet Explorer (including IE8).
◆list-style-type
Description: Sets or retrieves the default tag used by the object's list items. This attribute will take effect if the value of the list-style-image attribute is none or the image at the specified URL address cannot be displayed.
Example
This example changes the type of the list:
Coffee
Tea
Water
Soda
The above is the detailed content of CSS: Detailed explanation of the usage of list-style list style. For more information, please follow other related articles on the PHP Chinese website!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn