Forum Moderators: open

Message Too Old, No Replies

Any Problems with using custom Tags?

         

cuce

10:33 pm on Oct 4, 2005 (gmt 0)

10+ Year Member



I've just discovered that I can create a tag in my css and use it in my html. here's an example:

CSS:
<style type="text/css">
monkey{font-size:50px;background:#cccccc;}
</style>

HTML:
<monkey>Oooh Oooh Aaah AAhh</monkey>

I have a feeling that this is probably not allowed by somebody somewhere. Seems like a fun trick though.
anyone?

encyclo

1:02 am on Oct 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is "not allowed" in that it won't ever valdate, but most modern browsers should handle this with no problems. A more common approach is to use custom attributes on known tags to trigger Javascript events - again it is frowned upon but it works. :)

The disadvantage is that you lose any semblance of semantics with your custom tag - it is usually better to pick a known, valid tag, even if it is a generic one such as

div
or
span
.

cuce

4:20 pm on Oct 5, 2005 (gmt 0)

10+ Year Member



Sounds reasonable.

Gives me an opportunity to put swear words in my code when i'm feeling disgruntled(jk).

Thanks for your help encyclo!