Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to create your own HTML element?

Is there a way to create your own HTML element? I want to make a specially designed check box.

I imagine such a thing would be done in JavaScript. Something akin to document.createHTMLElement but the ability to design your own element (and tag).

like image 712
Alan Avatar asked Jul 21 '10 23:07

Alan


People also ask

Can I create my own element in HTML?

Customized built-in elements inherit from basic HTML elements. To create one of these, you have to specify which element they extend (as implied in the examples above), and they are used by writing out the basic element but specifying the name of the custom element in the is attribute (or property).


2 Answers

No, there isn't.

The HTML elements are limited to what the browser will handle. That is to say, if you created a custom firefox plugin, and then had it handle your special tag, then you "could" do it, for varying interpretations of "doing it". A list of all elements for a particular version of HTML may be found here: http://www.w3.org/TR/html4/index/elements.html

Probably, however, you don't actually want to. If you want to "combine" several existing elements in such a way as they operate together, then you can do that very JavaScript. For example, if you'd like a checkbox to, when clicked, show a dropdown list somewhere, populated with various things, you may do that.

Perhaps you may like to elaborate on what you actually want to achieve, and we can help further.

like image 197
Noon Silk Avatar answered Oct 04 '22 00:10

Noon Silk


Yes, you can create your own tags. You have to create a Schema and import it on your page, and write a JavaScript layer to convert your new tags into existing HTML tags.

An example is fbml (Facebook Markup Language), which includes a schema and a JavaScript layer that Facebook wrote. See this: Open Graph protocol.

Using it you can make a like button really easily:

<fb:like href="http://developers.facebook.com/" width="450" height="80"/>
like image 44
BrunoLM Avatar answered Oct 04 '22 00:10

BrunoLM