Custom attributes

Simple question, hopefully receiving a wealth of answers …

how why and when do you use the ‘Custom Attributes’ box?

Im sure it opens up a world of possibilities that i just dont know about yet.

1 Like

When a developer asks you to do so :wink:

Custom attributes are textual information added to html tags. For example, if you create one custom attribute on a div, it will look like this in the code:

So it’s “only” a way to add information to an element, for a program to come afterward and do something with it.

While some attributes are common and commonly used by some libraries—such as “click” that Webflow forbids you to use because it’s commonly used—custom attributes are totally only text, free text. It’s arbitrary. It’s how the program who will perform tasks afterwards has been developed.

One example: it can be used to make a Webflow page dynamic with a JS program. So if the div we were talking about was the container of an avatar picture in a profile layout, a developer could ask you to add this: profile=“picture”. Once published on a server a program will get that info an place an image there.

Custom attributes allow you to work with developers without to have to break te compatibility with webflow. As the developer is going to use your code “as is”, you can continue to iterate your design in Webflow.

1 Like

This topic was automatically closed after 60 days. New replies are no longer allowed.