Quackit Logo
HTML
CSS
Scripting
Database
Hosting
Design
XML
IMCreator - Free Website Builder

DTD Attribute Default Values

In the example in the previous lesson, we defined an attribute using a default value of "No". In this lesson, we look at the various options for defining default values for your attributes.

Default Values

The attribute TYPE field can be set to one of the following values:

ValueDescription
valueA simple text value, enclosed in quotes.
#IMPLIEDSpecifies that there is no default value for this attribute, and that the attribute is optional.
#REQUIREDThere is no default value for this attribute, but a a value must be assigned.
#FIXED valueThe #FIXED part specifies that the value must be the value provided. The value part represents the actual value.

Examples of these default values follow.

value

You can provide an actual value to be the default value by placing it in quotes.

Syntax:

Code

Example:

Code

#REQUIRED

The #REQUIRED keyword specifies that you won't be providing a default value, but that you require that anyone using this DTD does provide one.

Syntax:

Code

Example:

Code

#IMPLIED

The #IMPLIED keyword specifies that you won't be providing a default value, and that the attribute is optional for users of this DTD.

Syntax:

Code

Example:

Code

#FIXED

The #FIXED keyword specifies that you will provide value, and that's the only value that can be used by users of this DTD.

Syntax:

Code

Example:

Code

Enjoy this page?

  1. Link to this page (copy/paste into your own website or blog):
  2. Link to Quackit using one of these banner ads.

Thanks for supporting Quackit!