HTML and CSS Reference
In-Depth Information
15.5.2. Required and Default Attributes
After you define the name and type of an attribute, you must specify
how the XML processor should handle default or required values for the
attribute. You do this by supplying one of four values after the attribute
type.
If you use the #REQUIRED keyword, the associated attribute must always
be provided when the element is used in a document. Within the XHTML
DTD, the src attribute of the <img> tag is required because an image tag
makes no sense without an image to display.
The #IMPLIED keyword means that the attribute may be used but is not
required and that no default value is associated with the attribute. If it
is not supplied by the document author, the attribute has no value when
the XML processor handles the element. For the <img> tag, the width and
height attributes are implied because the browser derives sizing inform-
ation from the image itself if these attributes are not specified.
If you specify a value, it then becomes the default value for that attrib-
ute. If the user does not specify a value for the attribute, the XML pro-
cessor inserts the default value (the value specified in the DTD).
If you precede the default value with the keyword #FIXED , the value is
not only the default value for the attribute, it is the only value that can
be used with that attribute if it is specified.
For example, examine the attribute list for the form element, taken (and
abridged) from the HTML DTD:
<!ATTLIST form
action CDATA #REQUIRED
method (get|post) "get"
enctype CDATA "application/x-www-form-urlencoded"
onsubmit CDATA #IMPLIED
onreset CDATA #IMPLIED
accept CDATA #IMPLIED
 
Search WWH ::




Custom Search