Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Posts
    147
    Thanks
    31
    Thanked 2 Times in 2 Posts

    html 4.01 or xhtml

    Hi

    whats better code my web pages in
    html 4.01 or xhtml

    and can you please tell me why?

    and where is the future going?

    thanks

    Andrew

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Well, let's add another factor: media type. This is a string sent in the 'Content-Type' header from the server when you request a document. HTML uses 'text/html'. XHTML uses 'application/xhtml+xml' for plain XHTML1, and 'application/xml' for multiple namespaces XHTML. XHTML can also be sent using 'text/html' if it conforms to Appendix C of the XHTML1 specification, but then you eliminate pretty much all the benefits of going for XHTML.


    Browsers will treat 'text/html' as HTML4 and 'application/xhtml+xml' as XHTML. Ie only supports the former.


    If you followed through that, you should have been able to read out that if you want ie compatibility, HTML4 is the way to go.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by liorean
    If you followed through that, you should have been able to read out that if you want ie compatibility, HTML4 is the way to go.
    You could also also use a server side script like this to give XHTML to browsers that support it, and HTML to those who do not.

  • #4
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    There's a lot more to change than just the MIME and DOC type. Especially if you have style or script blocks within the document.
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Quote Originally Posted by hemebond
    There's a lot more to change than just the MIME and DOC type. Especially if you have style or script blocks within the document.
    And here I was trying to make him take the right decision wihtout complicating the matter...
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #6
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    First, lets just answer his question:

    It's probably better to code in XHTML, because that is the latest standard, and if you know the latest, it won't be hard to learn the next version, as well as equipping you to do more, because of better features.

    The future of XHTML and Web Design is to completly separate your page content from the appearence of your page.

    This way, search engines, screen readers, and small screened devices will be able to get the important content of your page, without all the styling, which is designed to look good on a desktop/laptop computer. The way this is accomplished is by semantic coding, which makes your markup meaningful.

    EXAMPLE:
    Code:
    <div align=left>*
    <h1>
    NASA Field Trip
    </h1>
     <p>
     Yesterday, the [your school here] 6<sup>th</sup> Grade class went on a  field trip to the <acronym title="National Air and Space Authority Jet Propulsion Labratory">NASA JPL</acronym> testing grounds. 
     </p>
    </div>
    *I know that the align attribute is deprecated, I'm just using it to siplify a point.

    The browser looks and sees:

    left aligned container, holding heading one title, with a paragraph containing the acronym for NASA JPL.

    A PDA, with a 150x150 screen, could detach the style sheet, and just display the text, knowing that <h1> should be bigger, blacker, and on new line. <p> could be the normal text sixe/color, and acronyms do things when you hover over them. It wouldn't care what the bg image was, or the specified colr/size of <h1> and <p>. It would just display the defaults. The layout is probably not that important to someone on a PDA, who is only trying to get the latest news.

    HTH,
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #7
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by liorean
    And here I was trying to make him take the right decision wihtout complicating the matter...
    I thought you were, so I had to complicate things

    If you want a simple answer from me, here goes:

    Use HTML 4.01 Strict and CSS coded as if it was XHTML, just leaving tags like <br> open.

  • #8
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Quote Originally Posted by whizard
    It's probably better to code in XHTML, because that is the latest standard, and if you know the latest, it won't be hard to learn the next version, as well as equipping you to do more, because of better features.

    The future of XHTML and Web Design is to completly separate your page content from the appearence of your page.

    This way, search engines, screen readers, and small screened devices will be able to get the important content of your page, without all the styling, which is designed to look good on a desktop/laptop computer. The way this is accomplished is by semantic coding, which makes your markup meaningful.
    Well, remember, semantic coding isn't a requirement of xhtml. Well-formed code is. I've seen plenty of valid xhtml on this very site that is nothing more than a div for every table cell that got replaced.

    At this moment, especially because of IE's lack of support for xhtml, HTML 4 is the way to go for ultimate cross-browser capability. You can still code to XHTML standards, though, so when the time comes to switch it'll be that much easier to do so.

    I code all of my pages now in XHTML Strict and use PHP to send the correct headers... but it's not because it's optimal or recommended, it's because I am a big web nerd.

    Also, this article has a lot of useful info on making the switch, if you choose to do so:

    http://www.456bereastreet.com/archiv..._properly.html

    Quote Originally Posted by liorean
    Well, let's add another factor: media type. This is a string sent in the 'Content-Type' header from the server when you request a document. HTML uses 'text/html'. XHTML uses 'application/xhtml+xml' for plain XHTML1, and 'application/xml' for multiple namespaces XHTML. XHTML can also be sent using 'text/html' if it conforms to Appendix C of the XHTML1 specification, but then you eliminate pretty much all the benefits of going for XHTML.
    This doesn't complicate the matter?

  • #9
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Quote Originally Posted by rmedek
    This doesn't complicate the matter?
    It doesn't complicate it one bit, because in reality, HTML2, HTML4, XHTML1 or XHTML1.1 matters far less than 'text/html' versus 'application/xhtml+xml'. Browsers only know of one HTML superset, and that is a the total of HTML2, HTML3.2, and HTML4.01. Browsers only know one XHTML version, and that is what is bound to the XHTML1 namespace. The DOCTYPE affects parsing only to a minor degree, and only in one browser (how it affects rendering and scripting is a different story). The real choice is whether you should run it throught the error correcting HTML tag soup handler, or through the well formedness demanding XML/XHTML parser.

    If you run XHTML through the HTML parser, it's no more than HTML4 with a couple of rules that only affect validation.
    Last edited by liorean; 02-23-2005 at 09:46 PM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #10
    Regular Coder
    Join Date
    Oct 2002
    Posts
    147
    Thanks
    31
    Thanked 2 Times in 2 Posts

    ???

    ok so i read every thing and absorbed alot

    but i'm still un sure.

    what im getting out of what has been said is

    rather code with strict html 4

    is this right?

    or should i start to get into the habit of making my html a little more xhtml
    eg line break tag <br /> and not <br>


    thanks

    Andrew

  • #11
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    At the moment I don't think there's any right way to go about it. I've read excellent arguments on either side of the XHTML/HTML fence.

    Like I said, I've been coding to XHTML, but that's to satisfy the inner web-geek. Hemebond is a huge advocate of HTML 4, and he's correct that it's truly the only widely implemented code out there (as in, IE doesn't understand XHTML).

    You can code to XHTML and serve as text/html to satisfy the needs of IE, but then as Liorean states, you lose all the benefits of XHTML. I'd go with what works for you.

    Personally, if I was building a large business site, I'd go with HTML 4. If it was more of a personal, "stretch your coding legs" sort of site I'd try XHTML and some content-negotiation.

  • #12
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by rmedek
    Hemebond is a huge advocate of HTML 4
    Actually, I encourage the use of what is appropriate. I do usually advocate the use of HTML over XHTML, but that's to prevent XHTML from being used or served incorrectly. For all my own development (my in-house QA system) I use pure XHTML, because I know my users can accept it and I hate Internet Explorer.
    Last edited by hemebond; 02-24-2005 at 01:02 AM.
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #13
    Regular Coder
    Join Date
    Feb 2005
    Location
    Lawrence, Kansas
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macintosh

    Quote Originally Posted by hemebond
    Actually, I encourage the use of what is appropriate. I do usually advocate the use of HTML over XHTML, but that's to prevent XHTML from being used or served incorrectly. For all my own development (my in-house QA system) I use pure XHTML, because I know my users can accept it and I hate Internet Explorer.
    Hemebond, is that good advice? Not trying to rag on you, but as your signature says, you "only test in Firefox?" I hate IE, don't get me wrong, but you're going to lose some of your audience if you don't make sure you get cross-browser, cross-platform compatibility.

    I find that funny, since you advocate HTML over HTML? Why? Firefox is a browser that adheres (for the most part) to the ever-developing standards. XHTML is the next stage of HTML development.

    Can you explain your rationale?

    Every designer/developer should check out Jeffrey Zeldman's "Designing with Web Standards." It's a great book and it tells you why you should be using XHTML and CSS today. Well worth the read.

  • #14
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by grubesteak
    Hemebond, is that good advice? Not trying to rag on you, but as your signature says, you "only test in Firefox?" I hate IE, don't get me wrong, but you're going to lose some of your audience if you don't make sure you get cross-browser, cross-platform compatibility.
    That signature is in regards to code that I post on these boards. I post a standards-compliant solution to the posters problem, but that usually means it won't work in IE. It's up to the poster to add that functionality.
    Quote Originally Posted by grubesteak
    I find that funny, since you advocate HTML over XHTML? Why? Firefox is a browser that adheres (for the most part) to the ever-developing standards. XHTML is the next stage of HTML development.
    Because the majority of people don't use XHTML correctly, so it'd be better if they didn't use it at all. Plus they usually want to support IE, and you can't do that easily when using XHTML.
    Quote Originally Posted by grubesteak
    Every designer/developer should check out Jeffrey Zeldman's "Designing with Web Standards." It's a great book and it tells you why you should be using XHTML and CSS today. Well worth the read.
    Actually, while the book may state XHTML, it actually encourages the use of web standards and seperation of structure from style. HTML is just as much a standard as XHTML, and can be coded in a similar way.
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #15
    New Coder
    Join Date
    Jun 2004
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, if you ask me, newbies to web design should be learn or be taought HTML4 Transtional; allows some more flexibility, but much easier learning curve, if you ask me.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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