Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] Custom HTML Tags

Started by frankusthenerd Mar 5, 2009 at 11:50 AM 8 replies 3.3k views
Original Post
frankusthenerd
frankusthenerd
I was recently experimenting with making my own HTML tags using CSS stylesheets and I got some pretty satifying results. For example, I can do the following: This is a custom tag. I think this is really cool because I can annoy fellow developer with stuff like this! Just kidding! :) Anyways, I was wondering how well custom tags are supported across browsers. Any ideas?
leiavoia
leiavoia
That's like getting on your knees and begging for trouble.

Link found with google

Technically, there is a specific set of tags that are part of (X)HTML standards. Weird things you do on top of that are undefined.

If you are interesting in creating your own tags, you might look into XML for the web and XSLT. Eventually, you will still have to convert your custom tags into something standard for browsers to read. Given all that trouble, it's usually best just to write standard HTML.
frankusthenerd
frankusthenerd
Quote:
Original post by leiavoia
That's like getting on your knees and begging for trouble.

Link found with google

Technically, there is a specific set of tags that are part of (X)HTML standards. Weird things you do on top of that are undefined.

If you are interesting in creating your own tags, you might look into XML for the web and XSLT. Eventually, you will still have to convert your custom tags into something standard for browsers to read. Given all that trouble, it's usually best just to write standard HTML.


Never really used the blink tags, but, nevertheless, it's quite interesting and fun to make your own tags.
konForce
konForce
Just do:



a


b
Alex J Whapham
Alex J Whapham
Yeah, what Kon presented is 10x more dev-appropriate.
Haha. I got warned because of a rickroll.
frankusthenerd
frankusthenerd
Quote:
Original post by konForce
Just do:



a


b


I know about this. I develop web sites. After experimenting, I found that IE is unable to recognize custom HTML tags without modification of the DTD. Interesting!
ToohrVyk
ToohrVyk
There is no such thing as a custom HTML tag. The list of HTML tags is fixed by several standards (such as this one).

If you include any tag that is not covered by one of these standards in your document, then the document is not valid HTML anymore—this may mean that the browser displaying your document may do anything with it. Some will ignore the tags, others will incorporate them in the displayed XML tree without checking whether they are valid.

If you want to see how the various brosers react, take a look at browsershots. But there is no official support for these things.
Excors
Excors
The 'custom tags' won't work at all in IE - it parses each tag into an empty element (one named "FOO", one named "/FOO"). If you write then IE will start parsing into an element with content, but that's totally evil. Other browsers parse the tags kind of like or
, but they all do it slightly differently (e.g. Firefox 2 doesn't let you put block elements inside custom tags, but that was fixed in Firefox 3).

(DTDs are irrelevant - browsers ignore them entirely. You might trick the validator into saying your document is okay, but that's a waste of time.)

For your own sanity, don't use custom tags [smile]

Quote:
If you include any tag that is not covered by one of these standards in your document, then the document is not valid HTML anymore—this may mean that the browser displaying your document may do anything with it.
The HTML 5 draft does cover unknown tags, and requires them to be parsed identically to (via the "Any other start tag" steps). Mozilla, Apple and Opera have indicated that implementing the HTML 5 parsing algorithm is a long-term goal, so hopefully they will converge on that behaviour. (No idea what Microsoft plans to do, though.)
Sander
Sander
Quote:
No idea what Microsoft plans to do, though


Knowing them, they will probably come up with something by the time IE10 rolls around by 2025 [grin]
ID Merlin
ID Merlin
Still, annoying your fellow developers has some merit, in an evil, twisted way.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.