I am wondering is it possible to invent your own HTML codes? For example there are basic tags like <html>, <a href="yoursite.com">, <meta tag="keywords" content="your words"> etc etc etc. I'd imagine one would need some sort of programming skills to do this, but would like to know some thoughts on this :).

Very much possible but you need come up with your own browser which will interpret your tags the way you want.

going further, if you start to look at server-side languages, JSP for example, lets you define your own custom tags. If you do this in JSP, you don't need the browser to interpret your "invented" tags.

Cheers for the advice, I don't know all that much about programming etc I am more geared towards web design although I know there are some good benefits for a web designer having that knowledge.

You can simply define your own tags using a plain XML document, and then collaborate its way using simple scripts that will evaluates your tags on the browser.

Here's simple tag examples created in plain XML document format:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE myevents [
<!ELEMENT myevents (event*)>
<!ELEMENT event (#PCDATA|hour|minute|info)*>
<!ELEMENT hour (info)>
<!ELEMENT minute (info)>
<!ATTLIST hour 
         id ID #IMPLIED
         name CDATA #IMPLIED
         set CDATA #REQUIRED 
         off CDATA #FIXED "0">
<!ATTLIST minute 
         id ID #IMPLIED
         name CDATA #IMPLIED
         set CDATA #REQUIRED 
         off CDATA #FIXED "0">
<hour id="hOne" name="hOne" set="1">
<info>event&apos;s that take place if the current hour is 1</info>
<minute id="mOne" name="mOne" set="1">
<info>event&apos;s that take place if the current minute is 1</info>
<hour id="hTwo" name="hTwo" set="2">
<info>event&apos;s that take place if the current hour is 2</info>
<minute id="mTwo" name="mTwo" set="2">
<info>event&apos;s that take place if the current minute is 2</info>
* You must provide a lists of 12 <event> elements here including (hour | minute) enclosed in its collection.

* Those 12 <event> elements will be used as our pointer to get specific event(s), which will be displayed in the page. This elements is referenced with the JavaScript date object's ( getHours() and getMinutes() ) -->

I've created this tags (document) for timekeeping events in my site, and generated using AJAX to display whatever the issue i have on created tags.

Hope it helps...

You can write your own DOM, if you know how. But your site has to serve it too.

Strange things happen if you try something. In IE6 it doesn't seem to work, but in Firefox 2 and 3 the following works:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     <style type="text/css">
          mytag	{color:green}
     <mytag>some text</mytag>

The text is displayed in green. :D

You can do this in HTML:

<custom myAttrib="Hi there">Custom Inner Stuff</custom>

Browsers should just ignore the custom tag and its atributes, and hence they should display the "inner stuff" as if the tag wasn't there. Not much use except for colweb's point about FF honouring CSS directive - interesting. I wonder if IE7 and 8 do the same?

Custom attributes (of a regular or custom tag) may be of use to a script:

var c = document.getElementsByTagName('custom');
	alert(c[0].getAttribute('myAttrib'));//gives "Hi there" reliably cross-browser (afaik).

Custom attibutes can be very useful for controlling the bahaviour of scripts from HTML without having to edit the script. This is a whole topic in its own right.


var c = document.getElementsByTagName('custom');
	alert(c[0].innerHTML);//blank in IE6 (and maybe others)
	alert(c[0].firstChild);//error in IE6 (and maybe others)

Conclusion : HTML custom attributes can be useful. HTML custom tags don't appear to offer anything you can't do with regular HTML tags and their behaviour is not reliable cross browser.

As Essential says, if you want to be inventive, use XML. After all, "XML" is "Extensible Markup Language".