SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 38
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2005
    Location
    USA
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Should I switch to xhtml?

    What all is involved in switching from html to xhtml? Do I need to do anything other than change the doctype at the top of each page and then add closing "/" for single tags? I just noted on a post in another forum that the <a name="#"> doesn't work in xhtml. Wow, I use lots of those on my sites.

    I see lots of information about xhtml but none about how important it is to "upgrade". Elucidation will be appreciated.

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unless you are mixing in content from other XML namespaces (e.g. MathML or SVG), or you need to use CDATA sections, there is no reason whatsoever to change.

    Remember that Internet Explorer has no support for XHTML, so you'll still have to send HTML to the majority of your visitors.

    Changing from HTML to XHTML is a major step, if you want to do it properly. You must serve the documents with another media type (the Content-Type HTTP header). This cannot be done by changing anything in the document itself, but must be controlled on the web server, either by tweaking its settings or by using a server-side scripting technique (e.g. PHP).

    There are also some differences in how CSS is handled, and some major differences in how JavaScript is handled. You cannot 'hide' styles and scripts in <!-- SGML comments --> anymore, and things like document.write() will no longer work.

    Unless you know that you need XHTML, there is no point.

    I'm sure lots of others will tell you differently, because they believe – incorrectly – that XHTML served as text/html is somehow 'stricter' or 'more modern' or even 'more semantic' than HTML.
    Birnam wood is come to Dunsinane

  3. #3
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    I personally use XHTML, but only to get 'geared up' for the future, with good structuring skills. As Tommy has said, on the web, it doesn't make much difference right now.

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2005
    Location
    USA
    Posts
    84
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks! I wish I'd found these forums ages ago--you all have answered some of my most often-asked questions in just two days. I've been wondering these things for over a year and others haven't been able to help me.

    I will definitely NOT be switching to xhtml! LOL I have been amazed at how frustrating IE is when it comes to web design. Obviously the "most popular" is not the "best"! Now I'm discovering how sensitive Firefox is too.... what fun. Ack.

    Thanks for answering so quickly and letting me know there is no need to change over! Yea!

  5. #5
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IE really isnt that hard to "tame", once you figure out the rules and I think everyone will agree IF you are going tableless you really need to rethink the way you design a site. I know when I first learned I looked at a page and saw tables. Now I look at a page and see divs and floats, its a mindset change.

  6. #6
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Netherlands
    Posts
    672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If there is no real difference between html and xhtml right now, why would you NOT develop in xhtml?

    unleast xhtml has the future, since html is no longer being developed? Or am i missing something obvious here ?

    And it is a good thing that firefox is pretty strict about webpages, it makes you write cleaner code
    Go visit my site :-D you know you want to ;-)
    www.mech7.net

  7. #7
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pixelsoul
    If there is no real difference between html and xhtml right now, why would you NOT develop in xhtml?
    Because if you don't know what you're doing (i.e. understand the fundamental differences between X(HT)ML and HTML) you can create very bad 'XHTML' documents that are no more future-compliant than HTML.

    Quote Originally Posted by pixelsoul
    unleast xhtml has the future, since html is no longer being developed? Or am i missing something obvious here ?
    Maybe. XHTML 2.0 will not be backward compatible with either HTML or XHTML 1.0. Converting well-written HTML 4.01 Strict to XHTML 2.0 will incur the same amount of work as converting well-written XHTML 1.0 Strict to XHTML 2.0.
    Birnam wood is come to Dunsinane

  8. #8
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Netherlands
    Posts
    672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm that sucks so in a few year we will all need to convert out xhtml 1.1 strict page.. to make it 2.0 compliant


    Quote Originally Posted by AutisticCuckoo
    Because if you don't know what you're doing (i.e. understand the fundamental differences between X(HT)ML and HTML) you can create very bad 'XHTML' documents that are no more future-compliant than HTML.


    Maybe. XHTML 2.0 will not be backward compatible with either HTML or XHTML 1.0. Converting well-written HTML 4.01 Strict to XHTML 2.0 will incur the same amount of work as converting well-written XHTML 1.0 Strict to XHTML 2.0.
    Go visit my site :-D you know you want to ;-)
    www.mech7.net

  9. #9
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The majority of (X)HTML and CSS works in most browsers, including IE. If your markup is correct, you will rarely find yourself 'hacking' (I call it adjusting to cater for user preferences, but call it what you wish) the markup.

    By all means use XHTML, the W3C recommends its use and says something along the lines of 'XHTML will become standard in the future'. Might as well make the transition whilst you can.

    Once you're comfortable with XHTML 1.0 strict, try move to XHTML 1.1, I prefer using XHTML 1.0 Transitional personally, for ease of use for the end user. Remember it's not always about developer preferences, it's about what works properly, as well as how easy you make it for the end user.
    Equentity, LLC - Coming Soon

    Have a question? Ask here

  10. #10
    SitePoint Enthusiast Wolfy_Websites's Avatar
    Join Date
    Jan 2005
    Location
    My Computer
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Personally, i'd stick with html
    What?
    Typo's aren't illegal you know...

    I be lonely..add me to your msn contacts!

  11. #11
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry I got my quote wrong, XHTML is the standard, the quote is 'XHTML will replace HTML in the future'.

    Yes you should switch.
    Equentity, LLC - Coming Soon

    Have a question? Ask here

  12. #12
    SitePoint Addict will_'s Avatar
    Join Date
    Apr 2004
    Location
    Asheville, NC
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo
    I'm sure lots of others will tell you differently, because they believe – incorrectly – that XHTML served as text/html is somehow 'stricter' or 'more modern' or even 'more semantic' than HTML.
    Just curious - are you saying that XHTML and HTML equal semantically? I was under the impression that XHTML is more well-formed and semantic. Am I wrong?

  13. #13
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XHTML 1.0 is just a reformulation of HTML 4.01 as an application of XML. Nothing was added, nothing was removed. It even has the same three DTD variants as HTML 4.01 (strict, transitional and frameset). It is exactly the same, semantically. It is not more strict either, but the syntactic rules of XML allow fewer shortcuts than those of HTML. Some people consider that to be more 'strict', but in either case the grammar is unambiguous.

    XHTML 1.1 removes a few small things that are present in HTML 4.01 and XHTML 1.0, and it also adds Ruby annotations. It only comes in one flavour (corresponding to the strict DTDs of the earlier versions). Thus it is not more strict. I'm not even sure that you can say it's more semantic, except that it offers Ruby annotations. Since browser support for those is virtually nil (without add-ons), the merits are questionable. For Westeners, the merits of Ruby annotations are questionable anyway.

    XHTML enforces well-formedness constraints since it is XML. HTML does not. Well-formedness has nothing to do with strictness (nor semantics), it is just a matter of taste. Of course, a syntax which is required to be well-formed is much easier to parse which is the whole point of W3C trying to guide developers over to XML. An XML parser is much easier to write and much more lightweight to run than a full-blown HTML or SGML parser.
    Birnam wood is come to Dunsinane

  14. #14
    SitePoint Evangelist sputza's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Converting an old site to XHTML may not be worth the time. However, I have done it to all my websites for good practice and to stay up to speed with the W3C.

    I think the question is, do you think it will be worth your time to convert with no added benefits of XHTML? I think it’s worth it only based on thinking ahead. I don't want to be caught with my pants down once XHTML is fully supported.
    Steven Watkins
    Chief Web Ninja
    Code Monkey Interactive
    lowgravity.ca

  15. #15
    ~unplugged Ainslie X11's Avatar
    Join Date
    Feb 2005
    Location
    Langley, Virginia
    Posts
    1,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pauly
    The majority of (X)HTML and CSS works in most browsers, including IE. If your markup is correct, you will rarely find yourself 'hacking' (I call it adjusting to cater for user preferences, but call it what you wish) the markup.

    By all means use XHTML, the W3C recommends its use and says something along the lines of 'XHTML will become standard in the future'. Might as well make the transition whilst you can.

    Once you're comfortable with XHTML 1.0 strict, try move to XHTML 1.1, I prefer using XHTML 1.0 Transitional personally, for ease of use for the end user. Remember it's not always about developer preferences, it's about what works properly, as well as how easy you make it for the end user.
    Just so there's no confusion, xhtml with css works in most browsers as does html4.01 with css. If you're using css for presentation, *hacking* is a necessity... xhtml doesn't 'fix' any of the browser rendering issues.


    working hard is hard work

  16. #16
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Connecticut, USA
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes XHTML works in IE.

    • Everything must be in lower case

    • All tags are cloesed...tags that were not closed in HTML are closed with a space and />

    • XHTML is picky...it will not tolerate sloppy, incorrect code. If the code is not correct the page will not display correctly. (Which is why you should use it)

    • Using valid code to standards i.e...XHTML and CSS assures cross browser/cross OS comatibility
    Tina *aka* 'Roo'
    • Web Design • Galleries • Weblog • KidsWeb

  17. #17
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    *sigh* How many times must we argue this in this forum?
    Quote Originally Posted by Roo1
    Yes XHTML works in IE.
    HTML compatible XHTML, yes; true XHTML, no.

    Quote Originally Posted by Roo1
    • XHTML is picky...it will not tolerate sloppy, incorrect code. If the code is not correct the page will not display correctly. (Which is why you should use it)
    Sloppy HTML code can cause rendering problems too.

    Quote Originally Posted by Roo1
    • Using valid code to standards i.e...XHTML and CSS assures cross browser/cross OS comatibility
    Theoretically, yes; in practice, no. There are so many bugs in browsers. This will be more true once all major browsers pass the Acid 2 test. However there will still be the problem of fixing things in older browsers.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  18. #18
    ~unplugged Ainslie X11's Avatar
    Join Date
    Feb 2005
    Location
    Langley, Virginia
    Posts
    1,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Roo1
    • Using valid code to standards i.e...XHTML and CSS assures cross browser/cross OS comatibility
    - if only that were true... I so so wish it was, there wouldn't be alot happening here

    http://www.sitepoint.com/forums/forumdisplay.php?f=53


    working hard is hard work

  19. #19
    SitePoint Evangelist
    Join Date
    Feb 2005
    Posts
    581
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Roo1
    • All tags are cloesed...tags that were not closed in HTML are closed with a space and
    The space is only intended to make the tag render in non-XHTML compliant browsers. In true XHTML, you don't include the space.
    I will not flame the newbies,
    I will not flame the newbies,
    I will flame the newbies...
    Table free is the way to be!

  20. #20
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Roo1
    Yes XHTML works in IE.
    No it does not. Invalid HTML (like <br/>) works, i.e. XHTML markup served as text/html, but that is not XHTML, that is HTML. XHTML markup served as application/xml "works", but you'll have to provide a CSS style sheet that emulates the default styles (e.g. p&#160;{display:block}). But that is not handled as XHTML by IE, but as generic XML.

    Try viewing a real XHTML page in IE, and then tell me that IE supports XHTML.

    Quote Originally Posted by Roo1
    • Everything must be in lower case
    Any browser will accept UPPERCASE or MiXeDcAsE 'XHTML' as long as it's served as text/html (which you must do for IE). Why? Because it's not XHTML. It's HTML, which is case insensitive.

    Quote Originally Posted by Roo1
    • All tags are cloesed...tags that were not closed in HTML are closed with a space and />
    XHTML does not need any space before />. Some old HTML browsers do, but if you're using HTML, why include the / in the first place?

    Quote Originally Posted by Roo1
    • XHTML is picky...it will not tolerate sloppy, incorrect code. If the code is not correct the page will not display correctly. (Which is why you should use it)
    That is only true for real XHTML (served as an application of XML). That does not apply to 'XHTML' served as text/html, because ... it is HTML. Am I getting through yet?

    Quote Originally Posted by Roo1
    • Using valid code to standards i.e...XHTML and CSS assures cross browser/cross OS comatibility
    Ha ha. Very funny.
    Birnam wood is come to Dunsinane

  21. #21
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    I suppose it does assure cross browser compatibility assuming the user agent is flawless.

  22. #22
    ~unplugged Ainslie X11's Avatar
    Join Date
    Feb 2005
    Location
    Langley, Virginia
    Posts
    1,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xhtmlcoder
    I suppose it does assure cross browser compatibility assuming the user agent is flawless.
    properly coded, but then it would also apply to html4.01

    xhtml guarantee's "nothing"


    working hard is hard work

  23. #23
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    It requires well formedness if served correctly and it can be XML Standalone unlike HTML but as one said before browsers with bugs are very common.

  24. #24
    ~unplugged Ainslie X11's Avatar
    Join Date
    Feb 2005
    Location
    Langley, Virginia
    Posts
    1,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well formedness hasn't got anything to do with a site rendering properly across browsers.

    Browsers with bugs depends entirely how you wanna define 'bugs'. I code everyday and most of that time is spent making sites render as they're intended to look across the main browsers, pc and Mac - let's not forget x-platform issues while we're at it.

    The code may always be wellformed, it's the *hacks* that deal with rendering issues - and alot of other factors too many to blog-on about here.


    working hard is hard work

  25. #25
    SitePoint Zealot
    Join Date
    Jun 2005
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure I follow these comments about 'ture' XHTML. The W3C spec clearly states 'true' XHTML caters for all browsers, even the god forsaken IE.
    Equentity, LLC - Coming Soon

    Have a question? Ask here


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •