Attributes Required by HTML Elements


What Is a Required Attribute in an HTML element?



A required attribute is an attribute required by the HTML element. When you write an HTML element, you must include all attributes required by this element in the opening tag. Optional attributes can be omitted in the opening tag.

Here are some examples of required attributes:

  • <form action="submit.php"> - "form" element requires one attribute: "action".
  • <script type="text/javascript"> - "script" element requires one attribute: "type".
  • <img src="/fyi.gif" alt="FYI"/> - "img" element requires two attributes: "src" and "alt".


Predefined HTML Attribute Values

Ampersand Sign in HTML Attribute Values

HTML Tag and Attribute Syntax

⇑⇑ HTML Tutorials

2023-09-26, 1246🔥, 1💬