Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XHTML - adding new elements

How can I add new tags to the xhtml document without making the markup 'invalid'?

for eg:

instead of <span class="time"> I'd like to use <time>. Is this possible? because I've seen a facebook app do something like this.

like image 848
Alex Avatar asked May 28 '26 03:05

Alex


1 Answers

You need to declare a new namespace for your invented elements:

<html xmlns:foo="urn:my-namespace">
...
<foo:time>...</foo:time>

or

<html>
...
<time xmlns="urn:my-namespace">...</time>

Of course, this isn't going to make an ounce of sense to your browser but I presume you have good reasons to want to do this.

like image 149
x0n Avatar answered May 30 '26 19:05

x0n



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!