Any way to attach custom-attribute to the HTML element?

Hello,

My developer ask me to place a custom attribute on the <html> element. For the time being we’ve figured that we can put it on the <body> element.

But I’d like to know if there’s a solution if we ever need to place an attribute on <html>.

Thanks

1 Like

Personally… I’ve never done this. But I did come across someone a couple months ago who did this.

This is the page he pointed out to me.

And… hmm - interesting because at the bottom of that page it says… “Custom Elements with Shadow DOM”.

This - is reference to another post I did.

Now the fun part… trying to figure out how to make a straight line go diagonal.

I think this will be an html5 solution only - and will fail on html4 or below.

It’s custom attributes, not elements.

FYI Webflow allows to add custom attributes to anything.

We use this to make webflow templates dynamic. “ng” refers to Angular JS and often is required to add custom attributes to the HTML element… which is one of the rare things you can’t alter in Webflow, even in custom code.

This was a non issue though because in the vast majority of the cases these attributes can be set on the Body element.

We use them to set functionality to things like list filters

Or to alter the classes of an element to modify its aspect

Or to place lists of teasers (also some html {{ fields }} in this image)

and finally nodes, from another cms

oh. we are talking about different things.

it’s those darn glasses of mine.