Which pattern to use: HTML5 or XHTML5?

Asked

Viewed 1,185 times

7

Why should we not mix the two and which of the patterns is most useful today?

  • 5

    Being the Devil’s Advocate: unfortunately HTML5 was chosen in place of XHTML, by a popularization decision (in XHTML you have to write the right code, HTML5 accepts any crap and makes the best possible effort to interpret). Because these decisions are made by a mix of committees and a bit of market forces, and not necessarily by a group with technical depth and practical experience, HTML and CSS are what they are today, where you have all the resources in the world, but it is always having to do the biggest "dance" to be able to make the basic things work logically.

  • @Bacco Cool your placement... but what do you mean by difference between writing right code in XHTML and any HTML5 crap? Is it not possible to write code right in both, with technical quality level in both? Thank you!

  • 3

    In XHTML, by the original specification, if the tags do not open and close right, for example, it is for the browser to fail, and not show. It will simply appear that the document cannot be displayed because it is poorly formed. In HTML it is worth the concept of "interpret it the way you can", if the structure is wrong. This causes many developers to simply see on the screen, and if it "looks good", publish as is. And a lot of times, it goes on air with real problems.

  • I understood this example of yours. In one of the answers below it was also mentioned. But can you cite some other reasons, apart from that? Thank you!

  • 2

    If I find an article, I’ll send you a link. This debate was "cold" a few years ago, actually. At the time the subject was heated, but who won the "arm wrestling" was HTML5.

  • 4

    This conversation reminded me of wanting to have a mug like this: CSS is awesome! kkk

Show 1 more comment

2 answers

8


XHTML is abandoned, all versions. Old ones are still supported by browsers. Version 5 as far as I know is not supported by any and will not be, except for things that match HTML5. The way is HTML5.

In particular I consider it a mistake, even if permitted, to use any element of XHTML, for example the trailling Slash.

Answer in Software Engineering.SE.

  • 3

    Well remembered for Slash trailing. Contrary to what people imagine, in HTML5 the Slash trailing does NOT close the tag. It is simply ignored.

  • Using elements of XHTML, such as Slash trailing, do I have any advantage (example: backward compatibility)? Or he was not accepted even in his prime?

  • 2

    @Arthursiqueira backwards compatibility with what exactly? Not quite XHTML elements within HTML5 (although there is, like Svgs or others), but I believe the AR speaks of the use of trailing Slash in "VOID" tags (I think this is the name)

  • @Guillhermenascimento type <br /> or <hr /> (Is that what I understood from his reply)? I think there might be better compatibility with older browsers, in the same way that we use features like babel.js to improve the compatibility of Javascript code

  • 1

    @ArthurSiqueira https://answall.com/q/46370/101

  • 1

    @Arthursiqueira trailling Slash was supported in HTML4.01, but the absence of this in XHTML no, however I do not see with anyone could want to use a Firefox3 for example, almost nothing used today works in old browsers, i have an FW front that supports basic fallbacks for IE8 and Android2.3 (native browser) and only, otherwise, type IE6 or 7 nor does it make more sense to discuss, other thing, outside XML+XHTML, had in the browsers the DOCTYPES, but even if I remember the traillings did not affect

  • 1

    @Arthursiqueira Just for the record, when the AR speaks of XHTML speaks of HTML eXtendido and not of XML+HTML, the presence of XML in XHTML is part of this, but an XHML may not contain any XML... only VOID tags (br, hr, input, etc.) that would need trailling, but in HTML5 this became optional, and DOCTYPE in older browsers is not supported, soon the browser would enter Quirksmode or Standarmode, read on: https://answall.com/q/209593/3635

Show 2 more comments

2

HTML5 is the latest evolution of the standard that defines HTML. It is a new version of the HTML language, with new elements, attributes, and behaviors. Once it has become standard it’s time for every web developer to migrate to it, because in my view it’s cleaner and more flexible.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.