25 replies [Last post]
dugal
dugal's picture
Offline
Enthusiast
Last seen: 5 years 51 weeks ago
Joined: 2007-08-06
Posts: 149
Points: 0

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

Tags:
Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 1 year 1 week ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

This should help answer your

This should help answer your question: http://www.sitepoint.com/forums/showthread.php?t=393445

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

dugal
dugal's picture
Offline
Enthusiast
Last seen: 5 years 51 weeks ago
Joined: 2007-08-06
Posts: 149
Points: 0

Thanks Tyssen, it does

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.

Triumph (not verified)
Anonymous's picture
Guru

dugal wrote:Thanks Tyssen,

dugal wrote:
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.

Well, let us know when one of your questions aren't covered in the link that Tyssen posted. Until then...

dugal
dugal's picture
Offline
Enthusiast
Last seen: 5 years 51 weeks ago
Joined: 2007-08-06
Posts: 149
Points: 0

What doctype do you use and

What doctype do you use and why?

Is there a drawback to going strict XHTML?

Triumph (not verified)
Anonymous's picture
Guru

dugal wrote:What doctype do

dugal wrote:
What doctype do you use and why?
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.

dugal wrote:
Is there a drawback to going strict XHTML?

If you know why you are using XHTML then there is no drawback. If you do not there is no purpose.

dugal
dugal's picture
Offline
Enthusiast
Last seen: 5 years 51 weeks ago
Joined: 2007-08-06
Posts: 149
Points: 0

Triump, thanks for

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.

Deuce
Deuce's picture
Offline
Guru
Las Vegas, NV
Last seen: 1 year 18 weeks ago
Las Vegas, NV
Timezone: GMT-5
Joined: 2005-11-20
Posts: 4422
Points: 1841

I personally code in XHTML

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 ยป http://dictionary.reference.com/browse/all

Google isn't a bunch of guys reading and grading web sites, it's more like a bunch of monkeys sniffing food and putting the good bananas at the top. -Triumph

Triumph (not verified)
Anonymous's picture
Guru

dugal wrote:...doesn't

dugal wrote:
...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. My answer is "sometimes". I usually use an XHTML 1.0 Strict doctype but I've been using HTML 4.01 Strict a bit lately but my markup still meets XHTML 1.0 Strict standards. That's why I say "it doesn't matter much".

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 18 hours 13 min ago
London
Timezone: GMT+1
Joined: 2004-06-06
Posts: 15650
Points: 2788

You ask whether there is any

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 :shrug:

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.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

dugal
dugal's picture
Offline
Enthusiast
Last seen: 5 years 51 weeks ago
Joined: 2007-08-06
Posts: 149
Points: 0

Thank you Deuce, Triumph,

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

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 18 hours 13 min ago
London
Timezone: GMT+1
Joined: 2004-06-06
Posts: 15650
Points: 2788

Sorry wasn't implying you

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.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 1 year 49 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

In practical terms there

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.

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 1 year 1 week ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Chris..S wrote:If you do use

Chris..S wrote:
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.

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
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 1 year 5 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

I hate to break up the party

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!

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 1 year 1 week ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

roytheboy wrote:Thus with

roytheboy wrote:
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.

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
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 1 year 5 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

I don't disagree with you

I don't disagree with you Tyssen. I was only adding my thoughts in the interests of making the discussion as complete as possible Smile

Life's a b*tch and then you die!

Triumph (not verified)
Anonymous's picture
Guru

Would anyone disagree with

Would anyone disagree with me sticking this one to the top?

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 18 hours 13 min ago
London
Timezone: GMT+1
Joined: 2004-06-06
Posts: 15650
Points: 2788

Your call!

Your call!

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

rbfree
Offline
Enthusiast
Last seen: 5 years 12 weeks ago
Timezone: GMT-7
Joined: 2007-12-19
Posts: 124
Points: 0

serving xhtml as html

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

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 1 year 49 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

That's what the

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.

dugal
dugal's picture
Offline
Enthusiast
Last seen: 5 years 51 weeks ago
Joined: 2007-08-06
Posts: 149
Points: 0

found a reason

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"?>

where copy.xsl is a file that contains the following:



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

eloquent.blue.knight
eloquent.blue.knight's picture
Offline
Regular
Earth
Last seen: 5 years 25 weeks ago
Earth
Joined: 2009-02-16
Posts: 14
Points: 0

well I managed to make a web

well I managed to make a web page which complied with a doctype of Strict XHTML, I was quite proud of my achievements. Then I did some testing in multiple browsers (chrome, firefox, safari, netscape, opera) it was all good, then eventually I tested it in IE... it looked warped... not sure if that was an issue with the whole XHTML thing or not though... hmmm

Triumph (not verified)
Anonymous's picture
Guru

eloquent.blue.knight

eloquent.blue.knight wrote:

... not sure if that was an issue with the whole XHTML thing or not though... hmmm

Well, you posted in this year old thread but did you happen to read it?

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 18 hours 13 min ago
London
Timezone: GMT+1
Joined: 2004-06-06
Posts: 15650
Points: 2788

I summed it up once a while

I summed it up once a while back thusly, and I like to think rather succinctly Smile

If one has to ask which DTD to use then one should be using HTML strict, end of story.

There are too many issues involved in playing with XHTML let those of us that think we know what we are doing make fools of ourselves. Be smarter use HTML strict

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Triumph (not verified)
Anonymous's picture
Guru

Hugo wrote:I summed it up

Hugo wrote:

I summed it up once a while back thusly, and I like to think rather succinctly Smile

If one has to ask which DTD to use then one should be using HTML strict, end of story.

There are too many issues involved in playing with XHTML let those of us that think we know what we are doing make fools of ourselves. Be smarter use HTML strict

Bah, I'm using straigh up XML from now on. W00T!