SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 26
  1. #1
    SitePoint Addict
    Join Date
    May 2002
    Location
    Louisville, KY
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with xhtml strict page

    So I am starting to code with xhtml strict now, but i'm having some problems. any ideas about this page? i can't figure out why there are spaces.

    http://www.redtreedesign.com/index2.php

    Thanks!!
    JP

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Maybe you're going about cleaning up your code (if that's your intention) the wrong way. First go away from a table layout and investigate a tableless design using CSS and semantic markup and then worry about XHTML strict.

  3. #3
    SitePoint Addict
    Join Date
    May 2002
    Location
    Louisville, KY
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know I know... I thought about doing that... just thought I'd get away with doing this the easy way.

  4. #4
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do you want to use XHTML? I recommend HTML 4.01 Strict.

    Why should you avoid using tables for layout?

    These explain how to remove the gap:
    That mysterious gap under images and embedded objects
    Images, Tables, and Mysterious Gaps
    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.

  5. #5
    SitePoint Addict
    Join Date
    May 2002
    Location
    Louisville, KY
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool Thanks! Just got done converting to CSS too! I just feel cleaner!

  6. #6
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Good stuff.

  7. #7
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,122
    Mentioned
    29 Post(s)
    Tagged
    2 Thread(s)
    Kravvitz,

    Why do you want to use XHTML? I recommend HTML 4.01 Strict.
    Why?

  8. #8
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Because it's the latest W3C specification with any browser support worth mentioning?
    Because Internet Explorer has zero support for XHTML?
    Because XHTML is poorly suited for generic web publication unless you have a CMS that guarantees well-formedness?
    Because it's still unusual for sites to need to mix in elements from other XML namespaces into their markup?
    Birnam wood is come to Dunsinane

  9. #9
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What Tommy said.

    Tommy, don't you mean "without any browser support"? Your first point isn't clear to me.

    There's also the whole incremental rendering issue -- only Opera 9 has an XML parser that supports it.
    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.

  10. #10
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kravvitz
    Tommy, don't you mean "without any browser support"? Your first point isn't clear to me.
    I think...:
    Quote Originally Posted by AutisticCuckoo
    Because [HTML 4.01 is] the latest W3C specification with any browser support worth mentioning?
    Simon Pieters

  11. #11
    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 Kravvitz
    Tommy, don't you mean "without any browser support"? Your first point isn't clear to me.
    The story so far:
    Quote Originally Posted by Kravvitz
    I recommend HTML 4.01 Strict.
    Quote Originally Posted by markbrown4
    Why?
    Quote Originally Posted by AutisticCuckoo
    Because it's the latest W3C specification with any browser support worth mentioning?
    Birnam wood is come to Dunsinane

  12. #12
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought Tommy was referring to XHTML, not HTML. *shrugs* Thanks for clarifying, Simon and Tommy.

    Wouldn't it be more accurate to say "W3C hyper-text markup language specification"?
    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.

  13. #13
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,122
    Mentioned
    29 Post(s)
    Tagged
    2 Thread(s)
    I still don't follow...
    I use XHTML 1.0 Strict doctype because it ensures well-formed and structured markup, it forces you to keep your markup as ... extensible as possible. I thought these were all good things.

    I can make my XHTML pages display the same across browsers, so I don't get the bit about no support..

    Cheers,

  14. #14
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It doesn't ensure well-formed markup when you still serve it as text/html.

    I suggest you read these:
    Understanding HTML, XML and XHTML
    Ten questions for Tommy Olsson

    MIME types matter; DOCTYPEs don't
    Beware of XHTML
    No to XHTML
    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.

  15. #15
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,122
    Mentioned
    29 Post(s)
    Tagged
    2 Thread(s)
    Hi Kravvitz,
    Thanks for the links, so my “Valid XHTML 1.0!” pages are in fact “Invalid HTML 4.01!” pages.

    What's the downside of a well structured sematically accurate HTML document with a XHTML doctype so I can validate it by those rules - Making sure all my tags are closed ?

  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)
    The requirement for well-formedness makes XML parsers much easier to write than HTML parsers. An XML parser doesn't have to know about any special cases where end tags are optional or forbidden. It doesn't have to cater to attributes with unquoted values or to minimised attributes. Since XML is also case sensitive, it won't even have to change all tag names and attribute names to a single case.

    As a result, an XML parser can be much more lightweight and slightly faster than an HTML parser. This comes at a price, though: it will have to give up entirely at the first hint of an error. That's fine if the markup is generated by, e.g., a CMS that guarantees well-formedness. It can be a chore for markup written manually by a clued-in standardista. It will be a horrendous nightmare where multiple non-techie authors are contributing.

    Now, when well-formedness is a must – as it is for any XML document served as such, including XHTML – we can use a fast, lightweight parser. That's about it. There are no continent-shattering super advantages from well-formedness as such.

    HTML does not require XML-style well-formedness; in fact it actively prevents it by forbidding certain end tags. But here's the main point: it doesn't matter very much! Yes, an HTML parser will be more bloated and mayhap a hair slower than an XML parser. But the syntactic rules of HTML guarantee that valid markup can still be parsed unambiguously. There's no risk of an HTML parser misinterpreting a valid HTML document, even though some tags are omitted, some attribute values are unquoted and some attributes are minimised.

    So having an end-tag for each element may make it easier for us as developers to follow the code, but it's not that big a deal for parsers. What I'm trying to say is that well-formedness as a concept is sometimes overrated. Assuring that the markup is valid is far more important, IMHO.
    Birnam wood is come to Dunsinane

  17. #17
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,122
    Mentioned
    29 Post(s)
    Tagged
    2 Thread(s)
    So my Invalid HTML 4.01 pages are ok ?

  18. #18
    Brevity is greatly overrated brandaggio's Avatar
    Join Date
    Dec 2005
    Posts
    1,424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markbrown4
    So my Invalid HTML 4.01 pages are ok ?
    There is nothing really wrong per se with serving so-called "fake XHTML" (it would be more that it is viewed as undesirable) - you just aren't getting any benefit from the XML'ness of the code and there are some downsides - XHTML is more a standard that would have been great if IE really supported it but it doesn't properly. It made it into a lot of books as the preferred method, which was I think acting overly optimistic about its support, as evidenced by the fact that the real world HTML/XHTML code gurus around here would not suggest XHTML over HTML for most uses - even today in very late 2006.

    Partially due to IE's pervasiveness and also due to the way XML is typically parsed and rendered even in many browsers that can truly do it, the simple rule of thumb is to use HTML 4.01 strict unless you have some specific reason not to (e.g. a CMS that may require the use of XHTML, or MathML or SVG and so on).

    I think a lot of people look at using HTML like running Windows 98 when XHTML is Vista - this is not the case - they are equally contemporary - HTML is just better supported at this very moment.

  19. #19
    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 markbrown4
    So my Invalid HTML 4.01 pages are ok ?
    Only if you don't mind relying on browser bugs.
    Birnam wood is come to Dunsinane

  20. #20
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,122
    Mentioned
    29 Post(s)
    Tagged
    2 Thread(s)
    It's all HTML..
    Isn't a page that validates with an XHTML Strict doctype 'cleaner' than than it's HTML equivalent?

    Trying hard to get your point...

    You say that there are downsides, i'm yet to see it. Ok I'm declaring something as XML even when it's really not, it's text/html. agreed.

    Still,
    If I conform to 'the rules of XML', and rid my code of deprecated tags, and work on semantic markup, and all browsers/devices can accurately display that information then it's good enough for me

  21. #21
    SitePoint Zealot NinjaNoodles's Avatar
    Join Date
    Oct 2006
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's no reason to use strict. In fact, there's much less browser support.

    Use XHTML 1.0 Transitional.

  22. #22
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by NinjaNoodles
    There's no reason to use strict.
    Ever heard of separating presentation from content?
    Quote Originally Posted by NinjaNoodles
    In fact, there's much less browser support.
    Care to show us some evidence?
    Quote Originally Posted by NinjaNoodles
    Use XHTML 1.0 Transitional.
    Why?
    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.

  23. #23
    Brevity is greatly overrated brandaggio's Avatar
    Join Date
    Dec 2005
    Posts
    1,424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markbrown4
    It's all HTML..
    Isn't a page that validates with an XHTML Strict doctype 'cleaner' than than it's HTML equivalent?

    Trying hard to get your point...

    You say that there are downsides, i'm yet to see it. Ok I'm declaring something as XML even when it's really not, it's text/html. agreed.

    Still,
    If I conform to 'the rules of XML', and rid my code of deprecated tags, and work on semantic markup, and all browsers/devices can accurately display that information then it's good enough for me
    Mark, Tommy explains it fairly well here (in addition to all the other times and places he has kindly addressed this issue). This was a link already given suggested by Kravvitz, but perhaps it is worth a second look.
    Russ: Why do you like HTML 4.01 strict? Isn't it SO last season?

    Tommy: That may be so, but it's still a valid W3C 'standard,' and it is the latest standard with any widespread support. I think most people overestimate the benefits of XHTML, at the same time as they underestimate the benefits of using a Strict DTD. In my opinion, using a Strict DTD, either HTML 4.01 Strict or XHTML 1.0 Strict, is far more important for the quality of the future web than whether or not there is an X in front of the name. The Strict DTD promotes a separation of structure and presentation, which makes a site so much easier to maintain. You can re-style a site completely by updating a single CSS file, rather than making identical changes to 10,000 pages with presentational markup.

    It also has lots of benefits for the user (quicker download) and the server (less bandwidth), as well as for search engines (better content-to-markup ratio). Last but not least, it makes it a lot easier to create an accessible site.

    The main cause of confusion seems to be that many web authors think that HTML must be written as 'tag soup.' The truth is that you can - and should! - write HTML 4.01 that is almost identical to XHTML 1.0. Just because HTML allows some shortcuts doesn't mean that you should use them. There are even beginners who have been conned into believing that CSS can only be used with XHTML, not with HTML!

  24. #24
    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 markbrown4
    Isn't a page that validates with an XHTML Strict doctype 'cleaner' than than it's HTML equivalent?
    No, it cannot be cleaner. XHTML 1.0 and HTML 4.01 have the same set of element types and attributes; i.e., the same semantics.

    If one thinks that being consistent with end tags is 'clean', then the XHTML 1.0 Strict document may be cleaner than the HTML 4.01 Strict counterpart.

    On the other hand, if one thinks that removing all unnecessary tags is 'clean', then it's the other way round.

    If they are both served as text/html, then the HTML version is slightly cleaner from a browser point of view, since it doesn't have to work around some extra slashes that shouldn't be there (since it's been told that the document is HTML).

    Quote Originally Posted by markbrown4
    You say that there are downsides, i'm yet to see it. Ok I'm declaring something as XML even when it's really not, it's text/html. agreed.
    The downsides to that are negligible. It's just that there are no upsides – at least not from a technical point of view. In other words: you cannot benefit from XML features if you do this.

    If you serve XHTML as an application of XML, then you can. But the downsides become much more serious. Few users will be able to see it, to begin with, since most of them will use browsers that don't support XHTML (mainly IE). Also, you must be able to guarantee well-formedness. Malformed pretend-XHTML is usually handled by browsers' HTML parsers, but malformed real XHTML will cause the browser to come to a screeching halt. That's not usually considered to be user friendly. So if you're going down that route, make sure that it's well-formed before you make the document publicly available.

    Quote Originally Posted by markbrown4
    Still,
    If I conform to 'the rules of XML', and rid my code of deprecated tags, and work on semantic markup, and all browsers/devices can accurately display that information then it's good enough for me
    The important thing is to use a Strict DTD and validate by it. Whether you use XHTML or HTML is of no importance as long as you serve it as text/html. A clean, semantic document with presentation and behaviour separated from the structure and content is what we should all strive for. We can do that with HTML 4.01 Strict or with XHTML 1.0 Strict. It's your choice, but you should know why you're choosing one over the other.

    Quote Originally Posted by NinjaNoodles
    There's no reason to use strict. In fact, there's much less browser support.

    Use XHTML 1.0 Transitional.
    I'm sorry, but that's utter rubbish.

    A Strict DTD is basically a subset of a Transitional DTD, so to say that browsers don't support Strict DTDs is fallacious.

    XHTML 1.0 Transitional is an abomination that should never have seen the light of day. If the W3C wanted web authors to move toward better markup, they should have pushed the XML'ness of it and promoted separation of structure from presentation and behaviour. Why they decided to publish XHTML 1.0 Transitional is quite inexplicable.

    The important paradigm shift is from markup infested with presentational elements toward clean, semantic markup; inasmuch as (X)HTML allows such a thing. That makes web content much easier to maintain, it reduces server load and download times, and it makes it much more likely that the content can be made accessible.
    Birnam wood is come to Dunsinane

  25. #25
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,122
    Mentioned
    29 Post(s)
    Tagged
    2 Thread(s)
    Thanks Tommy,

    You've done good
    You may have even made a believer out of me.


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
  •