Jump to content

XHTML vs HTML


ejaboneta

Recommended Posts

In regards to SEO it's completely irrelevant. There are other considerations to take when choosing between XHTML and HTML though.

 

Just out of wonder, what are they? I only stick with XHTML because it sounds cooler than HTML :P

 

I've never actually researched the specific differences. I obviously know that it's cleaner, stricter, and requires shorttags, but that's it...

 

And no, I don't think google will "throw your site out". However, I've heard that bad code could affect your page rank.

 

And really bad code can result in google not being able to parse your page. So it's definitely worth having valid code, whether it's html or xhtml...

Link to comment
Share on other sites

Alright thanks. I read somewhere that if the site doesn't validate, google might throw it out. Is this true?

Not necessarily "throw it out"- it needs to index it to throw it out. Invalid code might cause it to not be indexed at all.

 

...but you should be coding valid code anyway.

 

In terms of HTML vs. xHTML, I'd go with xHTML, because it is the new standard. Unless you have some reason to stick to HTML.

Link to comment
Share on other sites

Alright thanks. I read somewhere that if the site doesn't validate, google might throw it out. Is this true?

 

Only Google themselves could tell for real, but I seriously doubt this is the case. Many websites do not validate yet rank just fine. Nevertheless, you should always make sure your markup validates.

 

In regards to SEO it's completely irrelevant. There are other considerations to take when choosing between XHTML and HTML though.

 

Just out of wonder, what are they? I only stick with XHTML because it sounds cooler than HTML :P

 

I've never actually researched the specific details. I obviously know that it's cleaner, stricter, and requires shorttags, but that's it...

 

Well, first of all, Internet Explorer does not support XHTML at all. According to the W3C specifications, for a page to be rendered as XHTML it must be served as application/xhtml+xml, however, if you do this to Internet Explorer the user will simply be prompted to download the page because IE doesn't know what to do with it. If you serve it as text/html then it will be parsed as HTML, not XHTML, by the browser and you are as such not really using XHTML even if you have an XHTML DOCTYPE and use XHTML syntax.

 

Secondly, due to XHTML being based on XML, you will have to deal with its draconian error handling. This means that upon finding even the slightest syntactical error in the markup, the parser will halt and present an incredibly unfriendly parse error message to the user, i.e. render the entire page useless. This of course only happens when you actually serve it as XHTML using the Content-type header though.

 

XHTML is neither cleaner nor stricter than HTML. The HTML 4.01 Strict DTD is just as strict as the XHTML 1.0 DTD. I'm not sure what you mean by cleaner though. I don't see why it's cleaner.

 

If you use true XHTML then you will already have blocked off the majority of internet users (i.e. users who use Internet Explorer) and you risk very easily making your pages entirely unusable to the rest of your users. If you don't serve it as XHTML then it'll not be treated as XHTML and you could just as well have written it as HTML.

 

In terms of HTML vs. xHTML, I'd go with xHTML, because it is the new standard. Unless you have some reason to stick to HTML.

 

That's plain simply incorrect. They're both being worked on alongside each other. XHTML is in no way a replacement for HTML.

 

 

There are a lot of misconceptions about XHTML and HTML based on cleanliness, strictness, newness, coolness, whateverness, etc. Most of it is entirely untrue and shows that many people do not truly understand the technologies they are using.

Link to comment
Share on other sites

That's quite interesting really.

 

Well, currently I conform to XHTML 1.1 basic standards. It displays fine on IE; I guess it's being interpreted as html.

 

And as for the cleaner part; I thought you didn't have to necessarily close tags in the right order in HTML? Whereas if you close tags in the wrong order in xhtml, you're flooded with errors.

 

And the shorttags make sense as well. Idk, it just seems neater to me...

 

Anyway, thanks for explaining.

Link to comment
Share on other sites

  • 2 weeks later...

 

And as for the cleaner part; I thought you didn't have to necessarily close tags in the right order in HTML? Whereas if you close tags in the wrong order in xhtml,

 

im pretty sure thats not right html tags need to be closed in order as well or your flooded with errors

Link to comment
Share on other sites

I discourage coding for XHTML simply because its "cooler." HTML and XHTML are equally as powerful. Only use XHTML if you forsee using XML in the near future. I know I will. XML has some powerful sorting abilities, and enables a program to code a piece of code with custom tags and use XML to transform the highly customized and reader-friendly code to plain mambo jumbo html. ha ha. I don't really mean that - I just like using that word. :)

Link to comment
Share on other sites

Well, I don't just code in xhtml because i prefer it (which I do anyway) but because I code other sorts of stuff in xml, such as a firefox extension I just developed. xml is way more versatile; it's just the language that I'm used to, so I code my site in it...

Link to comment
Share on other sites

Well, I don't just code in xhtml because i prefer it (which I do anyway) but because I code other sorts of stuff in xml, such as a firefox extension I just developed. xml is way more versatile; it's just the language that I'm used to, so I code my site in it...

 

Which can be translated to: "I don't code in XHTML because I prefer it, but because I prefer it" :P

Link to comment
Share on other sites

Google should render both fine; however, depending on how BAD your HTML is, the GoogleBot can throw your script out. If there is no way for the GoogleBot to read it, there is no way for it to read it... it's simple. XHTML will always be read clearly by the GoogleBot, so I would say just go with that.

 

As a general rule, you should always go with XHTML (unless you're sending e-mails or something).

Link to comment
Share on other sites

As a general rule, you should always go with XHTML (unless you're sending e-mails or something).

 

Why? I think you'll need to back up that claim.

 

It's good practice.

 

I beg to differ...

 

My reasoning is here: http://www.phpfreaks.com/forums/index.php/topic,241805.0.html

 

Now I'd like your reasoning. You didn't back up your claim, you just repeated yourself.

Link to comment
Share on other sites

daniel0 already said the truth in the matter from the beginning,

 

xhtml vs html well sorry html win's why?

 

Think about it in a financial aspect as well.

 

We all no that html works fine, so off course they had to invent the wheels again,

it called money ( books,collages,teachers teaching some think new)

 

Also ever body has different taste in programming/scripting, the idea that closing all open tags,

was a grate way off saying, hay there we go more money.

 

now days buy a html book, your see html advertising the grate xhtml,

(come on please buy me).

 

It the buz word for xhtml, it cleaner smarter looks better ,

well far as i am concerned html is just as smart as xhtml even smarter.

 

It also comes down to competition in the browser world, one want's to be

better then the other (( that also comes down to money)).

 

 

why would we even think that xhtml is better then html.

 

It called advertising new buz words.

 

So adding the theme of closing all tags, and adding a few short commands

makes xhtml more powerful or better NO wrong.

 

The truth off the matter is that xhtml is the opposite it made problems for it self,

xhtml is application based, like it mother xml.

 

The difference from html and xhtml are massive as compatibility goes.

 

you rely need to go back as daniel demostrated to

understand the concept between the two technology s

 

Never judge a book buy it cover .

 

 

and buy the way it not wrong to no either xhtml or html or xml

 

just remember html wins.

 

 

Link to comment
Share on other sites

As a general rule, you should always go with XHTML (unless you're sending e-mails or something).

 

Why? I think you'll need to back up that claim.

 

It's good practice.

 

I beg to differ...

 

My reasoning is here: http://www.phpfreaks.com/forums/index.php/topic,241805.0.html

 

Now I'd like your reasoning. You didn't back up your claim, you just repeated yourself.

 

I thought I'd explained it well. Is this a debate club or a php forums? (lol... scratch that. HTML VS XHTML... duh. bad rationalization)

 

If you're a developer, as the guy above obviously is, using XHTML is good practice. Odds are, someone's going to request it, and being intimately familiar with it makes it that much easier. I personally (personally) see XHTML & HTML as the difference between right and wrong... I'm not a good guy necessarily, but I try to make good habits (get it?).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.