Jump to content

Best Version of HTML?


Deji

Recommended Posts

What HTML do you reckon would give my websites the most benefit?My validation results come up with: "Tentatively passed, 1 warning(s)"for XHTML 1.0 Transitional, XHTML 1.1 and HTML 5 as my doctype is currently XHTML 1.0 Strict (which validates perfectly).According to the info on the validation page... even though they qualify for all those standards the website can only be valid for one... So my website is technically only valid for XHTML 1.0 Strict... Not all 4.So my question is... which do I choose? XHTML 1.1 seems to be the highest version of XHTML, but is it better than XHTML 1.0 Strict? And most websites use Transitional...Or should I choose HTML 5 for my doctype? It's not "finished" yet but Google may like the head start on the newest form of HTML... Plus I don't really "know" HTML 5 (although I guess since I know XHTML, that shouldn't matter).Which doctype is best? :) I felt chuffed to get the news that my website is like, perfect (actually, just the homepage is at the moment.. waiting for a decision before doing the rest). But it's sad to know that it can only be valid in one language.Maybe I could even use PHP or something and randomize the doctype per page load... Wonder what Google would think of that? :)

Link to comment
Share on other sites

Remember that HTML and XHTML are syntactically different (one being based on SGML, the other on XML). XHTML 1.0 is basically HTML 4.01 with XML syntax, but XHTML 1.1 has additional XML-specific features. Note that many of those features aren't really implemented though.The best way to decide is just to see what your site needs - if you really want some feature of HTML 5 (canvas?), then you may use it, but there are of course the compatibility issues - so the best option is HTML 4.01 or XHTML 1.0 (depending on which syntax you like, note that browsers don't technically do XHTML unless you serve the pages with application/xhtml+xml, which IE doesn't understand anyway - so maybe HTML).As to the type, strict is the best option. Transitional means your page isn't really up to date (or something like that :)).Rotating DOCTYPEs... aren't such a good idea.

Link to comment
Share on other sites

I'd suggest sticking to XHTML 1.0 Strict.Even though browsers parse it as HTML unless served as application/xhtml+xml, there's a benefit in the fact that the code looks like XML.If you later learn how to use XML APIs in PHP, you'll be able to manipulate your page with them, whereas if your page is in HTML, you'll have a much harder time doing the same manipulations. The same applies to any person using your site - it will be much easier for them to screenscrap your site, thereby increasing its value (assuming you have something they'd want to screenscrap of course).I'm not sure if Google even tries to use an XML parser, but if it did, it'd probably list you higher due to the "clean" (from its perspective) code. If not - there's no harm.HTML doesn't have any advantages over XHTML, and XHTML doesn't have any disadvantages over HTML. And advantages in XHTML other than the one above are only "potential"... Where's the harm in having potential?BTW, IE9 will support application/xhtml+xml, so the lack of IE support will no longer be an argument.

Link to comment
Share on other sites

Some of the XHTML rules are ridiculous... Mainly the lack of "div align" and, even worse, the fact that <a name= is no longer valid... And I absolutely hate Javascript in many ways.. syntax, difficulty and overall performance and effect on visitors.But it makes me feel all warm and cozy to have a validated website...What exactly is an XML API? I use PHP classes... Any similarities there? I never really use XML or understood the point of it when there are perfectly good ways to use MySQL... Which is so much more secure.. as I've experienced to my own benefit :)IE compatibility has never been an issue for me. I actually kinda dig the fact it hasn't changed too much. One thing that annoys me about Firefox is how it refuses to respond well to my attempts at horizontal div scrolling. But there are so many more Firefox compatible CSS stuff. Anyway I think once again I lost my original point. Thanks for the help.

Link to comment
Share on other sites

Some of the XHTML rules are ridiculous... Mainly the lack of "div align" and, even worse, the fact that <a name= is no longer valid... And I absolutely hate Javascript in many ways.. syntax, difficulty and overall performance and effect on visitors.
You don't need the "align" attribute because CSS can do that for you.You don't need the "name" attribute because you can do the same thing with the "id" attribute. What's more, you can put an ID on any element, so you don't have to have an extra <a> element if you want to jump to a specific part of the page.By the way, those aren't XHTML rules, those are the rules established by HTML 4.01.
Link to comment
Share on other sites

An id on any element.. then what? I can

<a href="#id">Link</a>

to it? Or does that use Javascript?The reason I still miss align is because of the extra length I have to go through to do things... My CSS files are getting pretty big with several CSS classes to do the same things, but a little different... All because I can't add 2 words to a tag? Really aggravating.

Link to comment
Share on other sites

My CSS files are getting pretty big with several CSS classes to do the same things, but a little different... All because I can't add 2 words to a tag? Really aggravating.
You can still use inline styles if you only need to change one or two elements. You don't necessarily have to create a CSS class for everything you need to style. For example:
div.mainStyle {font-family: Arial;font-size: 16px;font-weight: bold;}

<div class='mainStyle' style='width: 120px;'>Test One</div><div class='mainStyle' style='width: 185px;'>Test Two</div>

Link to comment
Share on other sites

Inline styles aren't such a good idea - remember that CSS is cascading, so you can apply rules to progressively more specific selectors:

body {	font-family:arial, helvetica, sans-serif;}p, ul, li {	font-size:10pt;}p {	line-height:18px;}p.red {	color:#F00;}

And that way you don't have to duplicate styles.

Link to comment
Share on other sites

What exactly is an XML API? I use PHP classes... Any similarities there? I never really use XML or understood the point of it when there are perfectly good ways to use MySQL... Which is so much more secure.. as I've experienced to my own benefit :)
An API is essentially a set of classes and/or functions grouped together for a certain purpose.MySQL, in PHP, is an API that consists of several functions that have the purpose of working with a MySQL server.MySQLi, in PHP, is an API that consists of a few classes that have the purpose of working with a MySQL server.DOM, in any language, is an API that consists of a set of classes that have the purpose of working with XML files (reading and writing them as a full document).XMLReader is an API consisting of one class used for reading XML files (node by node).XMLWriter is an API consisting of one class used for writing XML files (node by node).
An id on any element.. then what? I can
<a href="#id">Link</a>

to it? Or does that use Javascript?

No JavaScript here. And yes, this is exactly what you do, and clicking on the link will send you to the element with that ID.
The reason I still miss align is because of the extra length I have to go through to do things... My CSS files are getting pretty big with several CSS classes to do the same things, but a little different... All because I can't add 2 words to a tag? Really aggravating.
You only have to go to this extra length once. After that, if changes in the design occur, you can easily change one or two places in the CSS and be over with it. It's hard to appreciate that, exactly because it's so easy. It's like appreciating the fact that you can click Win+D to reach your desktop when you have a shortcut on the taskbar - both are easy to do, and feel redunant, but it's only when one is not available (faulty mouse would disable the icon, faulty keyboard would disable the keyboard shortcut) that your appreciate the other.I'll tell you a secret, but I sure hope you don't abuse it - you can have more than one class on an element, and apply the styles of all classes to it. For example:
.wrapper {margin:0 auto;display:block;}.error {background-color:red;color:white;}

and in (X)HTML, you can have for example:

<div class="wrapper">...<span class="error">...</span>...<div class="error wrapper">...<span class="wrapper">...</span>...</div>...</div>

How can you abuse it you ask? If you're thinking of making a class for every style you use, and apply the classes per style, don't - that's exactly the kind of abuse I'm talking about.Instead, make a class per usage, per role if you will. In the above example, an error has a red background and white text, but can be inline or block (i.e. be a wrapped error or not), a wrapper is always a centered block, but can be applied to otherwise inline elements.

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...