SEM Labs

Handcrafted Pixels, Code & Title Tags

Attribute

Elements

The XFL attribute element adds attributes to their parent element. For example adding a class on an input field.

Dissection of the XFL Attribute Element

Syntax

Attributes

Attribute Value Description Required
name text name of the attribute to add Yes

Static Example

The attribute element can be used to apply an attribute to its parent statically. The follwoning XFL fragment:

Will produce the below HTML output:

Conditional Example

The attribute element can also be used to apply an attribute to its parent element conditionally. The following XFL fragment:

Will produce the below HTML when the condition being tested by the XFL If element is met:

Data Example

The attribute element can also be used to apply an attribute with a value defined in the data document:

The XFL Valueof element will select the value of color resulting in the follwing HTML: