Attributes Required by HTML Elements

Q

What Is a Required Attribute in an HTML element?

✍: FYIcenter.com

A

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".

 

HTML Tag and Attribute Syntax

⇒⇒HTML Tutorials

2017-02-20, 172👍, 0💬