0

I have heard before that for xhtml, there ought to be a space between any attributes and the closing bracket of a tag. E.g. <a href="example.com" > instead of <a href="example.com">. Is this true for html5 (and for that matter was it true for xhtml)?

Rose Kunkel
  • 3,102
  • 2
  • 27
  • 53
  • 2
    Similar question: http://stackoverflow.com/questions/462741/space-before-closing-slash. It honestly doesn't matter what you do. – Justin Helgerson Apr 12 '13 at 00:37
  • I assumed it didn't actually matter for any sane browsers, but I was wondering if there was a technically correct choice. And that question isn't exactly what I'm asking. – Rose Kunkel Apr 12 '13 at 00:40

2 Answers2

2

In this case it is not a self-closing tag and both forms are equivalent, valid syntax in both HTML (at least 4+) and XML (including XHTML). The similar question linked in the comments is about /> constructs, which have historically been "icky".

If a resource said "ought to be", then they are merely talking about a convention as XML (and thus XHTML) doesn't care. Now, self-closing tags can be a different can of worms (that is mostly "fixed" with HTML5 rules), but they are unrelated to this particular syntax construct.

user2246674
  • 7,621
  • 25
  • 28
0

It doesn't really make a difference. Pretty much all browsers will read it correctly. I can't think of any that would read it incorrectly.

Noah T
  • 235
  • 4
  • 12