Tuesday 31 October 2017

html - Closing empty tags: XHTML5 or HTML5? Why one over the other?

After reading extensively about HTML5 and XHTML5 and after
reading this post: href="https://stackoverflow.com/questions/3558119/are-non-void-self-closing-tags-valid-in-html5?rq=1">Are
(non-void) self-closing tags valid in HTML5? , I have got a very simple
question:



"Is there a reason why it would be
good to serialise HTML5 as XML?"



I
understand:




  • the
    differences between HTML, XHTML, XML and HTML5

  • that it's
    good practice to nest elements correctly, use lower case letters, quote attributes,
    close tags etc...

  • that HTML5 has no DTD while XHTML has
    got a DTD and an XML parse


  • that if I specify a
    page as XHTML5 (HTML5 doctype + XHTML schema) some browsers might not process the page
    for minor errors
    etc...



So the question
is:



"In which case would it be good to follow
very strict XML rules when doing an HTML5
page?"



Above all when it comes to things
like



1) The void
elements




            src="asdsad.jpg" /> compared with 

compared with
comparted with



2)
Checked, download etc..
like



            name="vehicle" value="Car" checked> VS
name="vehicle" value="Car" checked="checked"
/>



Should
I just write following the HTML5 standard and implement as much common sense as possible
(lower case, good nesting) or is there A GOOD REASON for a standard company website to
be coded in XHTML5?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...