What Is a Required Attribute


What Is a Required Attribute? - XHTML Tutorials - Introduction To Tag and Attribute Syntax

✍: FYIcenter.com


A required attribute is an attribute required by the XHTML element. When you write an XHTML 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".

2007-05-12, 5202👍, 0💬