Are Custom Attributes OK in XHTML
Asked Answered
S

2

16

I understand that according to the HTML specification, it's invalid to add custom attributes to elements. Is this also invalid with XHTML?

I thought XHTML was part of the XML family, and as such was extensible. Being extensible, isn't it ok to use custom attributes?

Dave

Suitcase answered 9/3, 2010 at 22:38 Comment(1)
What is the reason for using custom attributes?Bow
S
10

custom attributes won't be considered valid by the standard W3C validators. You can define your own document type definition (DTD) though. See http://www.alistapart.com/articles/customdtd/ for more information about that.

Sarong answered 9/3, 2010 at 22:44 Comment(0)
Z
6

With the standard document type definition, you can't introduce your own custom attributes.

But, starting with HTML5 you'll be able to introduce your own attributes as long as you prefix them with data-.

Zombie answered 9/3, 2010 at 22:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.