HTML properties define attributes (i.e., the behavior or look) of an HTML element. For instance, category
is an HTML trait that provides a method to classify similar elements, and is employed with CSS to include styles to elements that share that category. url
is another HTML trait that specifies a link’s target URL.
You can produce some HTML properties using native Webflow elements, styles, and configurations (e.g., links, categories, ids, etc.). You can develop others using custom properties, which are beneficial for a variety of purposes — building tooltips, boosting your site’s accessibility with ARIA characteristics, expanding custom code and page styling capabilities with CMS data, and more.
Throughout this tutorial, you will understand:
- How to craft custom properties
- How to utilize CMS data in custom properties
- How to utilize component features in custom properties
- How to design components and CMS data with the category property
- How to control custom properties
Remember: Some custom properties are reserved, as you are already able to generate them using native Webflow elements, styles, and configurations. For example, you can’t designate url
as a custom property to an existing element to mimic a link, but you can define a link target URL on link elements using link settings.
How to craft custom properties
To formulate a new custom property:
- Select the element for which you wish to create a custom property
- Head over to Element settings panel > Custom properties
- Press the “plus” icon
- Enter the title of your custom property (e.g.,
tooltip
,aria-label
, etc.) along with its content
Pro tip: You can access a complete list of HTML attributes in the Mozilla HTML attribute reference.
How to utilize CMS data in custom properties
You can link your CMS data to custom properties to form a connection between design, code, and dynamic data — and empower more strength and flexibility in your design. This enables you to manage integrations or widgets that utilize HTML data properties (e.g., maps or social widget previews), employ custom CSS to adjust page styling based on the value of a CMS field, enhance site accessibility by employing CMS data to populate ARIA properties, and more.
Essential: You can exclusively link CMS data to custom properties on Collection pages or within Collection lists.
To link your CMS data to custom properties:
- Select the element for which you want to craft a custom property
- Visit Element settings panel > Custom properties
- Click the “plus” icon
- Enter the title of your custom property (e.g.,
tooltip
,aria-label
, etc.) - Click the violet “dot” icon in the content field
- Choose the Collection field you desire to link to your custom property
Pro tip: You can also attach your CMS data to ID properties, which are handled separately from custom properties in the Element settings panel. This allows you to set up unique IDs to recognize specific CMS items, which you can utilize to target those items with custom code.
How to utilize component attributes in custom properties
You can also relate custom properties to component attributes. These can be utilized, for example, to facilitate and regulate complex styling and CMS fields. Discover more about component attributes.
To connect component attributes to custom properties:
- Modify the primary component that embraces the element for which you want to craft a custom property
- Select the element for which you want to forge a custom property
- Go to Element settings panel > Custom properties
- Click the “plus” icon
- Enter the title of your custom property (e.g.,
tooltip
,aria-label
, etc.) - Click the violet “dot” icon in the content field
- (Optional) Establish a new component attribute
- Choose the component attribute you want to link to your custom property
How to design CMS data and components with the category
attribute
You can apply the category
attribute to generate style variations on CMS data and components with custom code classes or classes you’ve established in Webflow (i.e., crafted in the Styling panel). For example, you could apply the category
attribute to employ light and dark themes on card components throughout your site.
Remember: The category
attribute can solely be utilized with text-based CMS data and component attributes.
Note that the classes you devise in Webflow are lowercase and exclude spaces. For instance, if you generate a class in the Styling panel known as my awesome class
, the derived class is my-awesome-class
— thus to reference its styles in the category
attribute, you would input my-awesome-class
.
Moreover, Webflow adds an underscore to single-letter classes produced in the Designer (e.g., a class named c
turns into _c
).
Essential: The Style selectors panel doesn’t recognize any classes referenced on CMS data or component attributes. Before clearing out unused styles, make certain unused classes listedin the Panel of Style selectors, they are not utilized in any custom attributes on your website.
Data of Content Management System
To customize CMS data with the class
attribute:
- Choose the element for which you desire to generate a specialized attribute
- Head to Panel of Element settings > Special attributes
- Tap on the “add” symbol
- Insert
class
into the Identifier section - Tap on the purple “dot” symbol within the Value section
- Select the Collection section which you desire to link to the
class
attribute
Reminder: You are only able to associate CMS data with customized attributes on Collection pages or inside Collection lists.
Elements
To customize components with the class
attribute:
- Edit the primary component that encompasses the element in which you want to include a
class
attribute - Select the element where you wish to incorporate a
class
attribute - Proceed to Panel of Element settings > Special attributes
- Tap on the “add” symbol
- Insert
class
into the Identifier section - Tap on the purple “dot” symbol in the Value section
- (Optional) Form a fresh aspect of the component
- Select the feature of the component you wish to connect to the
class
attribute (e.g., “Theme”)
After that, to apply styles to this element within a component instance:
- Select the component instance on the canvas
- Access the Panel of Props
- Insert a class title (one you’ve specified in Webflow or in tailored code) as the content for the component feature attached to the
class
attribute (e.g., you could insertdark
as the content for the “Theme” component feature)
Explore further into component aspects.
Techniques to handle bespoke attributes
To amend a customized attribute:
- Select the element where you need to revise a customized attribute
- Head to Panel of Element settings > Special attributes
- Tap on the customized attribute you wish to amend
- Renew the identifier and/or contents of the customized attribute
To erase a customized attribute:
- Select the element where you seek to remove a customized attribute
- Access the Panel of Element settings > Special attributes
- Tap on the “garbage bin” symbol adjacent to the customized attribute you intend to erase
- Include or eliminate Workspace spots and members - April 15, 2024
- Centering box summary - April 15, 2024
- Store a site for future reference - April 15, 2024