SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 33

Hybrid View

  1. #1
    SitePoint Zealot ajaxdinesh's Avatar
    Join Date
    Apr 2009
    Location
    India
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Please Clarify XHTML 1.0?

    Hi,

    Shall i use this code for XHTML 1.0 Page? its 100% XHTML code?

    Also i need one clarification

    1. What is the advantage of this code?

    Code HTML4Strict:
    <?xml version="1.0" encoding="utf-8"?>
    <!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" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    </head>
    <body>
    XHTML 1.0
    </body>
    </html>
    Cheers,
    Dinesh

  2. #2
    Design Your Site Team bronze trophy Erik J's Avatar
    Join Date
    May 2007
    Location
    Countryside, Sweden
    Posts
    3,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the minimum you could start with. A title is mandatory and new pages should be strict, the transitional can be rendered different in rare cases also. The xml version before the doctype will throw IE into quirks mode.

    There is no advantage over HTML as it is served as html/text.
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title>Not Named Yet</title>
    </head>
    <body>
    <p>XHTML 1.0</p>
    </body>
    </html>
    Happy ADD/ADHD with Asperger's

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your code is contradicting itself. First it states that it is an application of XML, then you state that the content type is text/html. Those two statements cannot be reconciled.

    Either drop the XML declaration (first line) or the meta element. In the latter case you'll have to serve it as XML, though, which means it won't work in Internet Explorer. That can be a significant drawback... <--understatement of the year

    If you don't know about these issues, you really should use XHTML at all. Use HTML 4.01 Strict, which is the latest specification that is universally supported:
    Code HTML4Strict:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Document Title</title>
      </head>
      <body>
        ...body content...
      </body>
    </html>
    Birnam wood is come to Dunsinane

  4. #4
    SitePoint Zealot ajaxdinesh's Avatar
    Join Date
    Apr 2009
    Location
    India
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Hi AutisticCuckoo,

    All are recommend to XHTML for current webstandard(web 2.0) that time we can define this doctype.

    Code HTML4Strict:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    But you said this code.

    Code HTML4Strict:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    which one is current web standard?
    Cheers,
    Dinesh

  5. #5
    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 ajaxdinesh View Post
    All are recommend to XHTML for current webstandard(web 2.0) that time we can define this doctype.
    By whom? There are some things you can do with XHTML that you cannot do with HTML, but only if you serve it as real XHTML. And Internet Explorer doesn't support XHTML. At all. Using real XHTML will be very demanding, because the slightest error will cause an error message to display instead of the page. If you have user-generated content on your site you need to perform extensive validation before outputting it. And even if you supply all content yourself, you'd better not make any mistakes. Personally, I don't think it's worth it. (Yes, I currently use XHTML on my blog, but I've learned my lesson and will change it to HTML only if I ever find time to rewrite the software.)

    Quote Originally Posted by ajaxdinesh View Post
    which one is current web standard?
    Both are 'web standards', i.e., specified as recommendations by W3C. XHTML does not replace HTML, it is only a parallel standard for those who need XML features in their web documents. The main reason would be the need to include elements from other XML namespaces, such as SVG or MathML. If you don't have any such needs, HTML is a better choice because it doesn't require user agents to stop as soon as they encounter an error.

    XHTML 1.0 is just a reformulation of HTML 4.01 as an application of XML. It doesn't add or remove anything; it isn't 'stricter' or more semantic or anything. It's just a way to express the same thing using XML instead of HTML.

    You may want to read the XHTML vs HTML FAQ if you haven't already done so. Most of the differences and similarities are explained there.
    Birnam wood is come to Dunsinane

  6. #6
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    If you have user-generated content on your site you need to perform extensive validation before outputting it.
    Not really extensive. Many languages have XML functionality built into them, so for example in PHP you can validate if input is valid XML, identify the first error and alert the user to the error details and its line in about... 4, 5 lines of code?

    Personally I prefer the restriction. If you write a program, you don't want it just to ignore errors you make; Most don't have that ability, others handle it in unpredictable ways.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  7. #7
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by arkinstall View Post
    If you write a program, you don't want it just to ignore errors you make; Most don't have that ability, others handle it in unpredictable ways.
    That's why many programmers tend to use XHTML rather than HTML even though they might serve it as HTML. For non-programmers who don;t really care about the sorts of distinctions about errors that programmers care about HTML is the better option as most of them wouldn't understand the difference between HTML and XHTML anyway.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  8. #8
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,782
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    If you don't know about these issues, you really should use XHTML at all. Use
    Alright thanks for the advice..
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  9. #9
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Whilst I use the XHTML doctype, that is simply because I like to close tags.

    There is no benefit at all of using XHTML 1.0 over HTML 4.01. XHTML cannot be served as an actual XML document as intended because the guys at MS who are responsible for IE decided to ignore a standard. This is what we can expect from IE.

    So really, it doesn't matter if you write your page in XHTML1 or HTML4, both are pretty much the same thing.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  10. #10
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    And that is why the server-side validation should report XML errors, just like a compiler would. That way, things aren't updated unless things are pristine - as they should be!
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  11. #11
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Exactly. As I said before, it's common sense to validate xml before putting it online, and it's very easy to validate it.

    But what if you made the same error in a HTML document? You may have to look through it with your eye because the error may be acceptable HTML code, just not what you meant to have.

    Of course, such a thing isn't possible in XHTML, because opening and closing things is a MUST.

    And that is why strictness is better, for me.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  12. #12
    SitePoint Wizard silver trophybronze trophy
    Join Date
    Jul 2008
    Location
    New York, NY
    Posts
    1,432
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using real xhtml would be downright silly in a CMS environment...
    I could only imagine correcting hundreds if not thousands of errors spit out...

    And not to mention serving ads

    I mean look around on the web and see if you can find a handful of 100&#37; valid websites, really...

  13. #13
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by cooper.semantics View Post
    Using real xhtml would be downright silly in a CMS environment...
    I could only imagine correcting hundreds if not thousands of errors spit out...
    Perhaps for the average user but a programmer is used to applying much stricter standards in the first place and wouldn't make very many errors - and those they did make would get fixed sooner if the pages were actually served as XHTML.

    Quote Originally Posted by cooper.semantics View Post
    And not to mention serving ads
    If all browsers supported XHTML then those creating ads would need to be far more careful in how they created their ads.

    Quote Originally Posted by cooper.semantics View Post
    I mean look around on the web and see if you can find a handful of 100% valid websites, really...
    For web pages served as XHTML the number of valid web sites is way higher than it is for sites served as HTML. That in itself is proof of how much better XHTML is for getting your page written correctly.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  14. #14
    SitePoint Wizard silver trophybronze trophy
    Join Date
    Jul 2008
    Location
    New York, NY
    Posts
    1,432
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Perhaps for the average user but a programmer is used to applying much stricter standards in the first place and wouldn't make very many errors - and those they did make would get fixed sooner if the pages were actually served as XHTML.
    Editors are average users and they are the ones that deal with CMS content. It sucks for the programmers that have to come in and fix all the errors which could add up in the hundreds if not thousands.

    Quote Originally Posted by felgall View Post
    If all browsers supported XHTML then those creating ads would need to be far more careful in how they created their ads.
    Tell that to all the various companies that know little to none well formed markup.

    Quote Originally Posted by felgall View Post
    For web pages served as XHTML the number of valid web sites is way higher than it is for sites served as HTML. That in itself is proof of how much better XHTML is for getting your page written correctly.
    True, they have to be... I agree xhtml is better, but it's just not practical.

  15. #15
    SitePoint Zealot ajaxdinesh's Avatar
    Join Date
    Apr 2009
    Location
    India
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi AutisticCuckoo,

    If i have defined the Doctype HTML 4.01, its rendering all hand devices(Ex., Mobile)

    Finally you said, its not much important XHTML. We can use HTML 4.01 instead of XHTML

    shall we use HTML 4.01 to all feature sites?

    Any issue in feature?

    are you agree these points or not?

    1. You have maintain a small website that time only we can use XHTML.
    2. We can maintain a large website(e-commerce or blog or forum site) that time only we can use HTML 4.01. Because the standard not follow.
    Cheers,
    Dinesh

  16. #16
    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 ajaxdinesh View Post
    If i have defined the Doctype HTML 4.01, its rendering all hand devices(Ex., Mobile)
    I don't know everything about all hand-held devices, obviously, but it would surprise me if there are any that support XHTML but not HTML. There'd only be a handful of pages they could visit, since almost all 'XHTML' pages are served as HTML.

    Some, older, mobile devices may support only WAP, but that's a separate issue.

    The most important thing, in my opinion, is that if you really use XHTML it won't render in any version of Internet Explorer (desktop). Of course, if you serve it as HTML it will render in IE, but then you're not using XHTML at all.

    Quote Originally Posted by ajaxdinesh View Post
    Finally you said, its not much important XHTML. We can use HTML 4.01 instead of XHTML

    shall we use HTML 4.01 to all feature sites?
    Unless you need it to be XML, then there is no reason to use XHTML. Especially if you serve it as HTML, because then you are, effectively, sending invalid HTML to the browsers and relying on their bugs to make it work.

    Quote Originally Posted by ajaxdinesh View Post
    1. You have maintain a small website that time only we can use XHTML.
    You can use XHTML for any site you want, if you don't mind excluding Internet Explorer from it. But you'd better have some way to test documents before publishing, since the slightest mistake will stop the page from rendering.

    Quote Originally Posted by ajaxdinesh View Post
    2. We can maintain a large website(e-commerce or blog or forum site) that time only we can use HTML 4.01. Because the standard not follow.
    Again, you can use XHTML for a large site, too. But I doubt that there are many large sites that are willing to exclude the majority of users who still use Internet Explorer.
    Last edited by AutisticCuckoo; May 11, 2009 at 03:53. Reason: Corrected factual error
    Birnam wood is come to Dunsinane

  17. #17
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    I don't know everything about all hand-held devices, obviously, but it would surprise me if there are any that support XHTML but not HTML.
    Me too -- I didn't find any during my research two years ago.

    Quote Originally Posted by AutisticCuckoo View Post
    The most important thing, in my opinion, is that if you really use XHTML it won't render in any version of Internet Explorer (desktop or mobile).
    Actually IE on mobile would, according to the results of my research, parse XHTML using the HTML parser and would thus render (although maybe not correctly).

    This is pretty problematic since, if mobile browsers treat XHTML as HTML, you cannot use XHTML-only features on mobiles even if you wanted to and did everything correctly. Yay for XHTML propaganda.

    Fortunately desktop browsers aren't being this silly. Well, actually, Konqueror is being this silly, IIRC.

    http://simon.html5.org/articles/mobile-results
    Simon Pieters

  18. #18
    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 zcorpan View Post
    Actually IE on mobile would, according to the results of my research, parse XHTML using the HTML parser and would thus render (although maybe not correctly).
    Thanks for that, Simon! I've updated my earlier post.

    Quote Originally Posted by zcorpan View Post
    This is pretty problematic since, if mobile browsers treat XHTML as HTML, you cannot use XHTML-only features on mobiles even if you wanted to and did everything correctly.
    And the prize for Understatement of the Year goes to ... *drumroll* ... Simon!
    Birnam wood is come to Dunsinane

  19. #19
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    looks right to me

  20. #20
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    @AutisticCuckoo I'd agree that serving XHTML as XHTML is impractical, because of the scum-of-the-browser-world called IE. I still can't believe that the web development community is just giving up with it because of IE; due to that attitude XHTML will never reach potential.

    As for uploading XHTML files through FTP... seems a bit caveman to me really. If you don't check things BEFORE you put them on a live site (I use a development subdomain) then you really need your head checking. No matter what stage you are in the site development, you need to go through the write -> validate -> check -> fix -> repeat until no issues -> update processes. I really don't think I need to tell you this as it's common sense, but judging by your comments you're forgetting it.

    Anyway, to be honest I see only one real argument against XHTML, and that is IE. If the IE developers got off their backsides and decided to do something for a change, we wouldn't even be having this discussion.

    Sure, XHTML needs validation. I see that as a plus, and I always will. Would you write a server-side application and upload it to a live site without checking it? Would you write a C++ application and compile it, then distribute it without checking for errors (hypothetically speaking)?

    If you say no, and I do hope you would, why on earth would you forget that when marking up content?

    One thing I've noticed more and more recently is that I'm particularly strict when it comes to code, programming and otherwise. Whilst HTML certainly isn't programming, it deserves (albeit unrequires) that level of strictness. XHTML simply removes the bubble wrap from the katana blade that is markup. Sure, you need to know how to use it, but it's the same with everything computers.

    This is where the money comes into IT. You think your client's going to write valid markup? Doubtful, in fact they can produce downright disgraceful attempts. Of course, if they supplied a word document (which, in my experience, they prefer) and you put it onto their website for them, you now have an extra revenue stream and they have a perfectly accessible and correct website. Win-win, no?

    Some things are better left to the guys who know what they're doing. If a piano was made so that a tone-deaf maniac could play something to the quality of Tchaikovsky with a 5-minute prep lesson, then that would be a very sad day for music. Why is it that we let that happen to web development?

    Off Topic:

    Me? Sleep deprived? How did you tell!
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  21. #21
    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 arkinstall View Post
    I'd agree that serving XHTML as XHTML is impractical, because of the scum-of-the-browser-world called IE.
    But if you're not serving it as X(HT)ML, then you're not using XHTML at all. Any arguable benefits go right out the window; you're using invalid HTML, nothing more, nothing less.

    The only 'benefit' left is that a validator – should you remember to use one – will point out some completely unnecessary tags that you may have missed.

    Quote Originally Posted by arkinstall View Post
    I still can't believe that the web development community is just giving up with it because of IE; due to that attitude XHTML will never reach potential.
    Anything with draconian error handling is unlikely to have any potential for end users. Most authors are not programmers, after all. They think HTML Transitional is too strict, for Pete's sake!

    Quote Originally Posted by arkinstall View Post
    As for uploading XHTML files through FTP... seems a bit caveman to me really.
    One word: Dreamweaver. Lots of people use it and the default setting (IIRC) is to upload on save.

    Quote Originally Posted by arkinstall View Post
    If you don't check things BEFORE you put them on a live site (I use a development subdomain) then you really need your head checking.
    That may work if you publish a page every other fortnight or so, but not if you have a busy news site where dozens of people publish a hundred articles a day. They'll use a CMS, of course, but that CMS had better guarantee well-formed markup if it's using XHTML...

    Quote Originally Posted by arkinstall View Post
    I really don't think I need to tell you this as it's common sense, but judging by your comments you're forgetting it.
    I'm not forgetting it, and it is common sense for a programmer. But it's not necessarily so for a copywriter. Spellchecking? Yes, but that's about it.

    Quote Originally Posted by arkinstall View Post
    Sure, XHTML needs validation.
    No more than HTML needs validation. XHTML needs to be well-formed, though. Browsers will have to cope with invalid XHTML as long as it's well-formed. For instance, <span><h2>I'm Stupid</h2></span>.

    Quote Originally Posted by arkinstall View Post
    I see that as a plus, and I always will. Would you write a server-side application and upload it to a live site without checking it? Would you write a C++ application and compile it, then distribute it without checking for errors (hypothetically speaking)?

    If you say no, and I do hope you would, why on earth would you forget that when marking up content?
    No, I wouldn't deploy an application without checking it first. Why? Because debugging, fixing the error, recompiling, testing and redeploying would take a long time, during which the app would be inaccessible to my users. In a professional environment, it would also normally have to go through several testing stages, and the programmer wouldn't be allowed to deploy his/her own app to the acceptance test server or the production server.

    If there's a minor error in document markup, fixing it and re-uploading it is a matter of seconds. That's why content writers may not apply the same rigorous deployment procedures as programmers.

    Quote Originally Posted by arkinstall View Post
    XHTML simply removes the bubble wrap from the katana blade that is markup.
    That's the wrong analogy. XHTML simply adds a few bells and pink ribbons to the katana blade, in the form of sprinkled slashes and unnecessary end tags.
    Birnam wood is come to Dunsinane

  22. #22
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    The only 'benefit' left is that a validator should you remember to use one will point out some completely unnecessary tags that you may have missed.
    I disagree that those tags are completely unnecessary. Having those tags there can save a lot of time with future maintenance of the page as with them there the web page source is much easier to read. Those tags are ones which a browser might need to consider as optional because of all the poorly written pages but which ought to be included in any properly written page.

    One of the problems with the W3C standards is that they are standards for the browser writers and do not therefore include the other 70% or so of the standards that web page authors ought to be following.

    I don't think anyone has suggested that non-programmers should be expected to follow such strict rules but then the XHTML rules are relatively lenient compared to what can happen with a lot of small typos in proper programming code and so programmers are used to being a lot more precise in their code than other people.

    Validating against XHTML instead of HTML for a page to be served as HTML is worth it just for it identifying if you have left out or misplaced any of those extremely useful tags that make the page so much easier to maintain that you mistakenly suggested are unnecessary.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  23. #23
    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 felgall View Post
    I disagree that those tags are completely unnecessary.
    They are technically unnecessary, since their presence can be implied – unambiguously. Thus a user agent doesn't need them. I agree that they are useful for human readers, though. And that's why I do use them, even though they're unnecessary.

    Omitting tags was considered useful back when SGML and HTML first came about. Bandwidth was precious, as was storage space and memory. Why write any more than you have to?

    These days those concerns are mainly moot, except perhaps for some mobile devices. The only reason to omit tags today is probably laziness.

    Quote Originally Posted by felgall View Post
    Validating against XHTML instead of HTML for a page to be served as HTML is worth it just for it identifying if you have left out or misplaced any of those extremely useful tags that make the page so much easier to maintain that you mistakenly suggested are unnecessary.
    I've said it before, but I'll say it again: validators should only look for syntax errors; if you want something to enforce what current fashion decides is 'best practice' you should use something like lint(1).

    Omitting a </p> tag in HTML is not an error, because it is 100% clear where the paragraph ends, even without the end tag. Using an explicit end tag helps human readers, though, which is why it might be a good idea to write them out, but they are not strictly necessary for parsing the document. And HTML documents are mainly intended to be read by machines, not people.
    Birnam wood is come to Dunsinane

  24. #24
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    And HTML documents are mainly intended to be read by machines, not people.
    Except when you are the author of the page and are using an editor where you get to work on the tags directly where you want the code to be as easy to read and hence as easy to maintain as possible.

    Of course it would be possible to set up programs to do the conversions back and forth between browser optimised HTML with all the optional tags stripped out and author optimised XHTML. Then we'd have the best of both worlds with it. I wonder why such a useful program has never been produced (or if it has why it hasn't been properly publicised). Even just a lint program that reads XHTML and spits out web optimised HTML would be useful.

    Equally useful would be if they ported all the useful stuff from XHTML 1.0 back into HTML and called it HTML 4.1 - all it would need is a new doctype tag to identify what follows as real HTML rather than its being HTML with errors, nothing in the actual code or validation thereof would need to change from what currently exists for XHTML 1.0 except that it would no longer be necessary to use pretend HTML in order to do the logical thing and close all tags.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  25. #25
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    I have stated in many threads my preference towards XHTML, however unlike many, I serve my website correctly... XHTML 1.1 if browsers support it but for IE and the latter... HTML 4.01. I do happen to like the draconian error handling as I come from a programming background and the thought of syntax errors or invalid code makes my spine crawl Either way the way I choose to look at it is... Browsers which do have support for XHTML get the functionality and for browsers like IE which cannot handle the XHTML functionality they get a small but visible message at the top of the window saying "This website could perform better but Internet Explorer currently does not have the ability to take advantage of this website effectively, to see this site in all its glory perhaps try another browser!" (a little yellow highlighted popup) and PHP deals with the checks and triggers to make sure those that support it get what they can. It is simple to implement, and best of all, it means that I do not have to be inhibited by what code is implemented as I know my website will outright work (progressive enhancement) on a variety of platforms


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
  •