<dir>: The Directory element

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

<dir> HTML 元素用作文件和/或文件夹目录的容器,可能具有 user agent 应用的样式和图标。不要使用这个过时的元素;相反,你应该将 <ul> 元素用于列表,包括文件列表。

¥The <dir> HTML element is used as a container for a directory of files and/or folders, potentially with styles and icons applied by the user agent. Do not use this obsolete element; instead, you should use the <ul> element for lists, including lists of files.

警告:不要使用该元素。尽管存在于早期的 HTML 规范中,但它已在 HTML 4 中被弃用,并且已被完全删除。

¥Warning: Do not use this element. Though present in early HTML specifications, it has been deprecated in HTML 4, and has since been removed entirely.

DOM 接口

¥DOM interface

该元素实现 HTMLDirectoryElement 接口。

¥This element implements the HTMLDirectoryElement interface.

属性

¥Attributes

与所有其他 HTML 元素一样,此元素支持 全局属性

¥Like all other HTML elements, this element supports the global attributes.

compact Deprecated

此布尔属性暗示列表应该以紧凑的样式呈现。该属性的解释取决于用户代理,并且它并不适用于所有浏览器。

规范

¥Specifications

不属于任何当前规范的一部分。

¥Not part of any current specifications.

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看

¥See also

  • 其他与列表相关的 HTML 元素:<ol><ul><li><menu>
  • 对于 <dir> 元素的样式可能特别有用的 CSS 属性:
    • list-style 属性,可用于选择序数的显示方式。
    • CSS 计数器,对于处理复杂的嵌套列表很有用。
    • line-height 属性,可用于模拟已弃用的 compact 属性。
    • margin 属性,可用于控制列表的缩进。