Results 1 to 5 of 5

Thread: Combining xhtml and html on a website

  1. #1
    Join Date
    Sep 2007
    Posts
    13
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Combining xhtml and html on a website

    Hi guys,

    I'm beginning to think that I might be having the wool pulled over my eyes so to speak by an agency and wondered if someone who knows more than me could confirm...

    Would you combine html and xhtml on the same microsite? I'm sure you can, but wouldn't it make more sense to go for either one or the other?


  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    The main question is how are you going to serve your pages? Will it be html or XHTML? You cannot serve both of them together at the same time. You need to choose from the two and from the selection, use a proper DTD.

    If you mean to combine by the markups, ensure that if you are planning to serve your page as xHTML, you need to close all the tags (self-close is necessary) and use lowercase at all times. You should also note that name is deprecated in XHTML.

    There's no sense on combining the two really. Maybe you mean to observe proper closing of the tags (which is a mandatory in XHTML) on your HTML pages. Otherwise, I should say that you cannot really serve two masters at the same time.

    Hope that makes sense.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by georgie_b View Post
    Hi guys,

    I'm beginning to think that I might be having the wool pulled over my eyes so to speak by an agency and wondered if someone who knows more than me could confirm...

    Would you combine html and xhtml on the same microsite? I'm sure you can, but wouldn't it make more sense to go for either one or the other?

    You can combine HTML and XHTML in the same project in the sense that one page would be HTML and another XHTML. As rangaga states, you can't combine them both on the same page.

    Most people's definition of XHTML is HTML with self closing tags (though this isn't the true distinction between the two markup languages). In most cases, it's fairly simple to convert from one to the other. For example, a find-and-replace on "/>" to ">" should convert a XHTML page to HTML.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    This is a common misconception. There is a lot more involved in converting to XHTML than most people think, the biggest of which in most cases is probably that you have to drop IE support entirely, since IE currently has no support for XHTML.

    Some links:
    http://www.webdevout.net/articles/beware-of-xhtml
    http://www.hixie.ch/advocacy/xhtml
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    XHTML served as text/html is fine for just playing around and will work as well as HTML in most cases, but it is a bad habit to get into. Many developers think that they are doing something cool or advanced by developing in XHTML, when all they are really doing is just serving it as HTML, broken HTML at that, which browsers must error correct to parse. Another common misconception is that XHTML is required for the use of any xml. However, any xml (like for RSS, etc.) that will work on an XHTML page that is being served as HTML will work just as well on an HTML page (though it would likely not be technically valid on either). For any serious project meant to be cross browser, one should stick to HTML 4.01 strict.

    In short, yes. Whoever has suggested this is either messing with you, or doesn't really know what they are talking about. The only two possible exceptions I can think of being if part of the site is being done with some sort of CMS that doesn't lend itself to using HTML. These are poorly designed in regards to this issue, but they may be feature rich enough to be worth using, though there is probably a better equivalent that doesn't have the phony XHTML locked into it. Or if you are going to truly serve the XHTML as an application only for those browsers that support it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •