www.webdeveloper.com
Results 1 to 6 of 6

Thread: Question regarding HTML5

  1. #1
    Join Date
    Mar 2009
    Posts
    501

    Question regarding HTML5

    I have a simple question regarding singletons and how they should be handled in HTML5. Basically, should the syntax follow XHTML conventions?
    Which is correct, or does it matter?

    Code:
    <img alt="nada" src = "zzz.png" >
    or
    Code:
    <img alt="nada" src = "zzz.png" />
    with the forward slash right before the ending angle bracket?

  2. #2
    Join Date
    Jan 2011
    Location
    West-Mids, UK
    Posts
    8
    In HTML5, I believe the first example is valid markup, however I am used to XHTML, so I would use the second out of habit, and I'm pretty sure it wouldn't cause issues with HTML5

  3. #3
    Join Date
    Jun 2010
    Posts
    5
    Quote Originally Posted by mapleMitch View Post
    In HTML5, I believe the first example is valid markup, however I am used to XHTML, so I would use the second out of habit, and I'm pretty sure it wouldn't cause issues with HTML5

    Definitely, the second option is best to practice while coding... it will not create any error. "/" is used to denote the end of the tag code... and whenever there is a need to upgrade from HTML5 to higher version it will be beneficial and will be a required for all tags used in HTML....

  4. #4
    Join Date
    Jan 2011
    Posts
    117
    Quote Originally Posted by Tcobb View Post
    I have a simple question regarding singletons and how they should be handled in HTML5. Basically, should the syntax follow XHTML conventions?
    Which is correct, or does it matter?

    Code:
    <img alt="nada" src = "zzz.png" >
    or
    Code:
    <img alt="nada" src = "zzz.png" />
    with the forward slash right before the ending angle bracket?

    HTML is the "father" of XHTML.
    Therefore HTML doesn't conform to its children rules, habits, or idioms. It might approve them, but in no way does this oblige it to also obey them. It never did and never should!

    Therefore the correct HTML5 syntax is and will be, forever: <img alt="nada" src = "zzz.png" >.

    In contrast to XML, ML was always a cAse insensitive! One should know that HTML is a ML, not a XML - that is: XHTML, and learn to discern them.
    HTML is always served as "text/html" therefore: all HTML is parsed as case insensitive, including the majority of XHTML-like written code!

    Therefore the HTML5 Doctype declaration is:

    <!DOCTYPE html>

    ...providing that you can type it in ALLCAPS, Mixed Caps, or small caps.
    This <!DOCTYPE html> will trigger the HTML5 standards mode on the browser. The reason - as it seems - has finally prevailed …, therefore specifying the Meta tag in pure HTML, is also a breeze:

    <META charset=UTF-8>

    ...as always! -You don't have to self-close a 'singleton', for it is not a XM Language. Never was!

    You may also notice that you don't need to close (a parameter) value with quotes, you never did, but you never knew you don't need to.

    In pure html, - elements such as <HTML>, <HEAD> including <BODY> (in html5) are also optional.

    In fact they always were. Because ML is not XML and because ML has its own parser while XML is not using one in 99% of all cases.

    As about XHTML vs HTML syntax this quote might shed some more light :
    "Check your MIME type. (Actually, if you don’t know what MIME type you’re using, I can pretty much guarantee that you’re still using text/html.) Unless you’re serving your pages with a MIME type of application/xhtml+xml, your so-called “XHTML” is XML in name only."
    Mark Pilgrim

    One thing is for sure, XML was in collision with the Nature of the Web core purpose -which is : Internet Hosted Content and Information Delivery to the end User, not its form or data structure.

    Regards.

  5. #5
    Join Date
    Apr 2008
    Location
    Jeddah, Saudi Arabia
    Posts
    43
    I basically don't know much about HTML 5.
    Thank you for some good tips.

  6. #6
    Join Date
    Dec 2005
    Posts
    2,984
    I'm not sure who, if anybody told you the answer in this thread so here it is in plain English: When using HTML5 both of your original examples can be used and are correct. Although for your own sanity, it's best to stick to one convention or another.
    I've switched careers...
    I'm NO LONGER a scientist,
    but now a web developer...
    awesome.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles