/    Sign up×
Community /Pin to ProfileBookmark

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” >[/CODE]

or

[CODE]<img alt=”nada” src = “zzz.png” />[/CODE]

with the forward slash right before the ending angle bracket?

to post a comment
HTML

5 Comments(s)

Copy linkTweet thisAlerts:
@mapleMitchFeb 01.2011 — 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
Copy linkTweet thisAlerts:
@cools4uFeb 05.2011 — 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[/QUOTE]


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....
Copy linkTweet thisAlerts:
@Troy_IIIFeb 06.2011 — 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" >[/CODE]
or
[CODE]<img alt="nada" src = "zzz.png" />[/CODE]
with the forward slash right before the ending angle bracket?[/QUOTE]

[INDENT][INDENT]

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 :

[INDENT][I][FONT="Book Antiqua"]"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."

[b]Mark Pilgrim[/b][/FONT][/I]
[/INDENT]

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

Regards.[/INDENT][/INDENT]
Copy linkTweet thisAlerts:
@mirza_yasir4Feb 06.2011 — I basically don't know much about HTML 5.

Thank you for some good tips.
Copy linkTweet thisAlerts:
@aj_nscFeb 06.2011 — 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.
×

Success!

Help @Tcobb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...