An HTML attribute is a modifier of an HTML element. Particular attributes are
only supported by particular element types.
Some attributes are required attributes, needed by particular element types for
them to function correctly; while in other cases they are optional attributes.
Standard attributes are supported by a large number of element types.
Implementation
All HTML attributes implement Attribute interface.
The PatternAttribute can be used when an attribute can have only a set
distinct values.
The IdAttribute attribute specifies a unique id for an HTML element (the
value must be unique within the HTML document). This attribute is used for
example when identifying HTML components.
The StyleAttribute attribute specifies an inline style for an HTML element.
An inline style overrides any style set globally, e.g. styles specified in the
style tag or in an external style sheet.
The ClassAttribute attribute specifies one or more classnames for an HTML
component.
The AttributeContainer provides methods for creating, storing and manipulating
Attribute objects. It is used in all of the HTML components as the attribute handler.
protect(): This method locks an attribute to a given value. Such attribute
cannot be removed and locked value is immune to modification.
IMPORTANT NOTES ABOUT REQUIRING AND VALUE LOCKING!:
As default the style and class attributes can have multiple locked values
(Style properties and CSS class names) at
the same time and only the locked .
other attributes can have only one value as locked at the same time.
Attribute can be required and have a locked value at the same time.
This site uses cookies
In order to work as intended, this site stores cookies on your device. Accepting
improves our site and provides you with personalized service. Declining results
in one cookie being placed on your device so we remember your choice.