Element

元素是网页的一部分。在 XMLHTML 中,元素可以包含一个数据项、一段文本、一张图片,或者什么都没有。一个典型的元素包括一个带有某些 属性 的开始标签,其中间是文本内容,然后是一个结束标签。

Example: in <p class="nice">Hello world!</p>, '<p class="nice">' is an opening tag, 'class="nice"' is an attribute and its value, 'Hello world!' is enclosed text content, and '</p>' is a closing tag.

元素和 标签不是同一个东西。标签在源代码中开始或结束一个元素,而元素是 DOM 的一部分,DOM 是页面在 浏览器 中显示的文档模型。

另见