Streaming live at 10am (PST)

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


#1

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


#2

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.

http://blog.teamtreehouse.com/create-custom-html-elements-2

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.


#3

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


#4

oh. we are talking about different things.

it's those darn glasses of mine.


#5