Skip to content

Attribute

一句话解释

HTML attribute 是 name-值 pair on 元素标签那个配置 or 添加 extra 信息到 它.

用大白话说

Attributes 是 extra details 你 put 内部元素's 打开标签. 它们配置如何元素 behaves or provide additional 信息. 语法是 name="值", and an element can have multiple attributes separated by spaces.

Common attributes include src (the source URL of an image), href (the destination of a link), 类 and id (for styling and scripting), alt (alternative text for accessibility), and 类型 (the kind of input field).

Some attributes are boolean — their presence alone is enough, no value needed. For example, <输入禁用> disables the input. Attributes are how you customize elements without changing the HTML tag itself.

示例

html
<a href="https://example.com" target="_blank">Open Example</a>

<img src="photo.jpg" alt="A sunset" width="400" />

<input type="email" placeholder="[email protected]" required />

href, 目标, src, alt, 宽度, 类型, placeholder, and 必需 是 所有 attributes.

相关术语

相关资源

相关课程

  • HTML

    Attributes 是 introduced 使用 HTML 元素

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表