html or xhtml
Posted: Wed, 2007-09-26 11:24
I am finally getting really capable in producing the page that I want, and keeping it standards compliant. So I am thinking of swithing from html to xhtml, but have read articles against using xhtml.
So my question to you guys (and gals), is there any good reason not to use xhtml for web design?
Dugal


Moderator
Posts: 6535
Joined: 2004-05-01
Location: Brisbane
This should help answer your
Posted: Wed, 2007-09-26 11:28
This should help answer your question: http://www.sitepoint.com/forums/showthread.php?t=393445
How to get help
tags.
Post a link. If you can't post a link, post ALL your code, both HTML & CSS. No server-side code; just the code sent to the browser.
Use
My articles | CSS Reference
Enthusiast
Posts: 148
Joined: 2007-08-06
Thanks Tyssen, it does
Posted: Thu, 2007-10-04 13:48
Thanks Tyssen, it does help, but I have read numerous comparisons and opinions. What I am looking for is dialog, someone I can bounce questions off of.
Moderator
Posts: 5061
Joined: 2005-02-03
Location: Pennsyltucky, USA
dugal wrote:Thanks Tyssen,
Posted: Thu, 2007-10-04 15:42
Well, let us know when one of your questions aren't covered in the link that Tyssen posted. Until then...
Enthusiast
Posts: 148
Joined: 2007-08-06
What doctype do you use and
Posted: Thu, 2007-10-04 16:14
What doctype do you use and why?
Is there a drawback to going strict XHTML?
Moderator
Posts: 5061
Joined: 2005-02-03
Location: Pennsyltucky, USA
dugal wrote:What doctype do
Posted: Thu, 2007-10-04 16:34
A doctype has one purpose and that is to switch a browsers rendering engine into standards mode.
If you know why you are using XHTML then there is no drawback. If you do not there is no purpose.
Enthusiast
Posts: 148
Joined: 2007-08-06
Triump, thanks for
Posted: Thu, 2007-10-04 17:27
Triump, thanks for responding, I enjoy reading your advice on the forum. However,
"Doesn't matter much as long as the doctype is complete. Transitional doctypes are for updated pages with legacy markup that would be difficult or cost preventative to bring into full strict compliance. Strict doctypes are for newly created pages. There is no reason to use a transitional doctype (along with it's deprecated tags and attributes) on a new page.
A doctype has one purpose and that is to switch a browsers rendering engine into standards mode."
doesn't answer the question "What doctype do you use and why?" I understand what the transitional and strict are for. I am creating from scratch, so I use strict. That wasn't the question.
I am trying to find out if people on this forum are coding in XHTML as I have been reading a lot about this and want to interact with knowledgeable people about it.
Elder
Posts: 1630
Joined: 2005-11-20
Location: STL
I personally code in XHTML
Posted: Thu, 2007-10-04 18:49
I personally code in XHTML 1.0 strict for the only reason that I find it cleaner.
Each element has a definitive end and seems to have better structure.
Other then that, I don't actually use any XML features and some would argue that I should be using HTML 4.01, but I do what I do and I do it well (most of the time) so why change when I have a good thing going.
For the most part, i believe it to be a personal preference or a professional requirement...
all. <Dictionary.com http://dictionary.reference.com/browse/all>
Moderator
Posts: 5061
Joined: 2005-02-03
Location: Pennsyltucky, USA
dugal wrote:...doesn't
Posted: Thu, 2007-10-04 19:21
Moderator
Posts: 12037
Joined: 2004-06-06
Location: London
You ask whether there is any
Posted: Thu, 2007-10-04 19:22
You ask whether there is any good reason not to use XHTML (markup syntax)
Yes! unless you are delivering pages as application/xhtml+xml then strictly speaking you should not be using the XHTML style of markup, despite the fact that the W3C say that it is permissible to use the 1.0 DTD along with text/html it doesn't really mean that it's correct to or that one has gained one little jot extra.
If you are coding to strict HTML, well formed code etc then it could be argued that in fact you are doing things correctly and wouldn't be incurring the ire of the purists who understandably dislike the fad for writing xhtml syntax/markup when delivered to the tag Soup rendering engine.
Above all else base your decision on carefully considered arguments don't base it on the fact that it's faddy and trendy or that people think that it has somehow superseded html and therefore means one is producing better code, although there are many people more on the client side who will think this and expect to see xhtml
You have expressed disinterest in links as such but there are some thoughts on the subject if you head to the 'How To' section of the forum.
Hugo.
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me
Enthusiast
Posts: 148
Joined: 2007-08-06
Thank you Deuce, Triumph,
Posted: Thu, 2007-10-04 20:15
Thank you Deuce, Triumph, and Hugo. Exactly what I was after.
Hugo, it's not that I am disinterested in links, it's that I have read enough of them (html vs xhtml) that they offer nothing new at this point. I try and search for an answer first. When I discovered the how to section, I began to devour the content there. (I read more of the how to section every time it gets slow at work) Most comparisons seem to be wishy washy and I seek opinions of people who's knowledge I trust (ie posters on this forum.)
thanks again,
Dugal
Moderator
Posts: 12037
Joined: 2004-06-06
Location: London
Sorry wasn't implying you
Posted: Thu, 2007-10-04 20:27
Sorry wasn't implying you were disinterested in links per se ; realised that within the context of your question they were of little further use.
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me
Moderator
Posts: 5624
Joined: 2005-02-22
In practical terms there
Posted: Thu, 2007-10-04 21:04
In practical terms there isn't much difference between well constructed HTML and well constructed XHTML.
If you do use HTML it makes sense to follow alot of the XHTML syntax changes. Close all non-self closing elements, use only lower case for tag and attributes, use long versions of all attributes (e.g. checked="checked"), only use tags common to both. Once in the habit of carrying out the above you can swap from one to the other at will.
If you are strictly following strict, HTML has some advantages over XHTML when javascript is concerned. You can use document.write and innerHTML. Pragmatically you can do the same using XHTML in all current browsers.
The important thing isn't which one you use, but understanding the choices and the reasons behind good coding standards. Once you know all that, the question itself becomes irrelevant as you are deciding individually for each site/job based on what is most appropriate.
On Having Layout | The One True Layout | menus by listamatic
Moderator
Posts: 6535
Joined: 2004-05-01
Location: Brisbane
Chris..S wrote:If you do use
Posted: Fri, 2007-10-05 00:53
That's what I do. I do most of my current work in HTML 4.0 but using the practices mentioned by Chris; the exception being my own personal site which uses XHTML 1.1 as application/xhtml+xml and content negotiation for older browsers but for the sort of content I'm serving the only real advantage it has is that it keeps you on your toes with regards making sure all your code is valid because if it's not, the page won't display.
How to get help
tags.
Post a link. If you can't post a link, post ALL your code, both HTML & CSS. No server-side code; just the code sent to the browser.
Use
My articles | CSS Reference
Moderator
Posts: 2320
Joined: 2004-09-18
Location: Kent, UK
I hate to break up the party
Posted: Fri, 2007-10-05 09:25
I hate to break up the party but there is one more issue to consider: ill-informed or out-of-touch clients. As you will read in other articles, a few years ago XHTML was going to be 'the future'. Many coders (myself and other regulars of this forum included) switched to XHTML under the clear impression that HTML was an outgoing standard. In the event this has not transpired but there are still lots of people out there (including clients with a little bit of trade knowledge) who view HTML as outgoing and XHTML as incoming. Thus with the lack of any other reason to choose one standard over the other, you might find that you are seen by some to be more 'with it' if you code to an XHTML doctype.
Life's a b*tch and then you die!
Moderator
Posts: 6535
Joined: 2004-05-01
Location: Brisbane
roytheboy wrote:Thus with
Posted: Fri, 2007-10-05 12:11
If a potential client knows or cares enough about what doctype is used, hopefully they'll be amenable enough to reasons why not to use an XHTML doctype. If not, as Chris says, it's not going to be a deal breaker if you have to use one or the other.
How to get help
tags.
Post a link. If you can't post a link, post ALL your code, both HTML & CSS. No server-side code; just the code sent to the browser.
Use
My articles | CSS Reference
Moderator
Posts: 2320
Joined: 2004-09-18
Location: Kent, UK
I don't disagree with you
Posted: Fri, 2007-10-05 17:03
I don't disagree with you Tyssen. I was only adding my thoughts in the interests of making the discussion as complete as possible
Life's a b*tch and then you die!
Moderator
Posts: 5061
Joined: 2005-02-03
Location: Pennsyltucky, USA
Would anyone disagree with
Posted: Sun, 2007-10-07 00:05
Would anyone disagree with me sticking this one to the top?
Moderator
Posts: 12037
Joined: 2004-06-06
Location: London
Your call!
Posted: Sun, 2007-10-07 00:16
Your call!
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me
Enthusiast
Posts: 120
Joined: 2007-12-19
serving xhtml as html
Posted: Thu, 2008-01-31 17:28
Does this limitation apply to pages written and declared in xhtml but
served as html?
"If you are strictly following strict, HTML has some advantages over XHTML when javascript is concerned. You can use document.write and innerHTML. Pragmatically you can do the same using XHTML in all current browsers."
CSS n00b
Moderator
Posts: 5624
Joined: 2005-02-22
That's what the
Posted: Sun, 2008-02-03 13:25
That's what the "pragmatcally" is there for. Although the spec says one thing, all browsers(*) understand document.write and innerHTML when the doctype is XHTML.
(*) You should always do your own testing to confirm.
On Having Layout | The One True Layout | menus by listamatic
Enthusiast
Posts: 148
Joined: 2007-08-06
found a reason
Posted: Thu, 2008-02-21 13:54
After this discussion I decided to stick HTML 4.01 as it served my needs well. Now I am trying to help a friend with a website that targets handhelds and phone browsers. All of the validators use XHTML as a criteria for mobile phone validation. So this will be my first try at XHTML.
I found the following at http://www.w3.org/MarkUp/2004/xhtml-faq#need
Does Microsoft Internet Explorer accept the media type application/xhtml+xml?
No. However, there is a trick that allows you to serve XHTML1.0 documents to Internet Explorer as application/xml.
Include at the top of your document the line in bold here:
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="copy.xsl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
where copy.xsl is a file that contains the following:
<stylesheet version="1.0"
xmlns="http://www.w3.org/1999/XSL/Transform">
<template match="/">
<copy-of select="."/>
</template>
</stylesheet>
Note that this file must be on the same site as the document referring to it.
Although you are serving the document as XML, and it gets parsed as XML, the browser thinks it has received text/html, and so your XHTML 1.0 document must follow many of the guidelines for serving to legacy browsers.
Your XHTML document will continue to work on browsers that accept XHTML 1.0 as application/xml.
I was going to try this, but wanted to run it by the crowd here for advice.
Dugal