<li>: The List Item element
<li> HTML 元素用于表示列表中的项目。它必须包含在父元素中:有序列表 (<ol>)、无序列表 (<ul>) 或菜单 (<menu>)。在菜单和无序列表中,列表项通常使用项目符号来显示。在有序列表中,它们通常在左侧显示一个升序计数器,例如数字或字母。
¥The <li> HTML element is used to represent an item in a list. It must be contained in a parent element: an ordered list (<ol>), an unordered list (<ul>), or a menu (<menu>). In menus and unordered lists, list items are usually displayed using bullet points. In ordered lists, they are usually displayed with an ascending counter on the left, such as a number or letter.
Try it
属性
¥Attributes
该元素包括 全局属性。
¥This element includes the global attributes.
value-
该整数属性指示由
<ol>元素定义的列表项的当前序数值。该属性唯一允许的值为数字,即使列表以罗马数字或字母显示也是如此。此项之后的列表项继续从值集中编号。value 属性对于无序列表 (<ul>) 或菜单 (<menu>) 没有意义。 typeDeprecated Non-standard-
该字符属性指示编号类型:
a:小写字母A:大写字母i:小写罗马数字I:大写罗马数字1:numbers
该类型会覆盖其父
<ol>元素(如果有)使用的类型。注意:该属性已被弃用;请改用 CSS
list-style-type属性。¥Note: This attribute has been deprecated; use the CSS
list-style-typeproperty instead.
示例
有序列表
具有自定义值的有序列表
无序列表
技术总结
¥Technical summary
| 内容类别 | 没有任何。 |
|---|---|
| 允许的内容 | 流量内容. |
| 标签遗漏 | 如果列表项后面紧跟着另一个 <li> 元素,或者其父元素中没有更多内容,则可以省略结束标记。 |
| 允许的父级 | <ul>、<ol> 或 <menu> 元素。虽然不符合用法,但过时的 <dir> 也可以是父项。 |
| 隐式 ARIA 角色 |
listitem 当
ol、 ul 或
menu 的子级时
|
| 允许的 ARIA 角色 |
menuitem,
menuitemcheckbox,
menuitemradio, option,
none, presentation,
radio, separator,
tab, treeitem
|
| DOM 接口 | HTMLLIElement |
规范
| Specification |
|---|
| HTML Standard # the-li-element |
浏览器兼容性
BCD tables only load in the browser