SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mixing HTML and XHTML !doctypes in one web site

    I am developing a simple web site using HTML strict. Now I have a need for 1 page to be written in XHTML strict. The question is, can I simply write one page using a XHTML !doctype statement and make it work with the other HTML !doctype pages?

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,322
    Mentioned
    462 Post(s)
    Tagged
    8 Thread(s)
    Yes, the doctype works on a page by page basis. I'm a bit dubious about the idea that one page "needs" a certain doctype. How did you arrive at that conclusion?

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Ralph and thanks for the reply. The last page I am working on involves a photo gallery. I found some very specific advice on how to do that. the example is quite verbose with lots of source code. the author warns that if you do not use XHTML with her examples "lots" of browsers will go into quirks mode and not display images correctly.

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,322
    Mentioned
    462 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by willyd57 View Post
    the author warns that if you do not use XHTML with her examples "lots" of browsers will go into quirks mode
    She is really warning you against not having a doctype at all. It doesn't matter which one it is, as long as you have one. These days it's the norm just to use the simple (so called HTML5 doctype, though it's not really) doctype:

    Code:
    <!DOCTYPE html>
    A few years ago, the fad was to use an XHTML doctype served as text/html, so people tended not even to acknowledge that there were any alternatives, whereas these days, the fad has moved on, just like all other fashions.

  5. #5
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,314
    Mentioned
    19 Post(s)
    Tagged
    1 Thread(s)
    I agree with Ralph. If you're serving the page as text/html, then it doesn't actually matter which doctype you use. Browsers treat them all the same.
    "First make it work. Then make it better."

  6. #6
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool, and thanks for the clarification.


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
  •