表示 UI 小部件的语义 HTML 元素

Semantic HTML element representing an UI widget

HTML 中是否有代表 UI 小部件的元素?

我想知道是否有任何语义 HTML 元素是为可拖动时钟、天气预报或地址簿联系人等小部件设计的?

我不确定 <aside> 对于交互式 UI 元素是否有意义,以及 <dialog> 是否适用于模态对话框以外的任何东西,或者我是否应该坚持 <section> 甚至 <div>.

是的,有:根据定义,<article> 元素是为表示界面小部件而设计的。

W3C specifies:

The article element represents a complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be ( … ) an interactive widget or gadget, or any other independent item of content.

这很符合 Wikipedia definition of “widget”:

  • a generic type of software application comprising portable code intended for one or more different software platforms
  • a reusable element of a graphical user interface