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.
Results 1 to 8 of 8
  1. #1
    Regular Coder Doctor_Varney's Avatar
    Join Date
    Mar 2008
    Location
    Midlands, UK
    Posts
    649
    Thanks
    45
    Thanked 29 Times in 28 Posts

    A different question about doctypes

    When something goes wrong in a website and someone has suggested changing my doctype, often it works out...

    The trouble with this, is I am simply parotting their advice and doing what they say, without knowing why I am doing it.

    Where do I start to learn for myself about how to troubleshoot a document at the doctype level and to understand why a certain doctype is having the effect it has on the code?

    Otherwise, I just keep coming back and asking "why doesn't this work" and someone says "use this doctype instead" then I'll design another page and that doesn't work and so I have to come back with the same question.... again and again...

    Is there just one doctype I can stick to, that will work with all kinds of layouts?

    So far all of the information on doctypes has been grossly technical and uses definitions and terms I am not familiar with.

    The people who say: "use this doctype" or "that doctype" must know why they are saying it so, if you know about all this stuff, how did you come to learn it in the first place?

    I have read the information at the W3C Webschools but am none the wiser, as the doctype itself contains very complicated stuff. When I try reading the lessons, I find I get stuck in a minefield of information and get lost in all the links.

    Any help in understanding the basic concepts of this subject will be very gratefully appreciated.

    Many thanks

    Dr. V
    Last edited by Doctor_Varney; 08-29-2010 at 07:17 PM.
    Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.

  • #2
    Regular Coder ahayzen's Avatar
    Join Date
    Jun 2009
    Posts
    110
    Thanks
    8
    Thanked 11 Times in 11 Posts
    Hi Doctor_Varney

    Here is a easy explanation of the doctypes
    http://www.w3schools.com/tags/tag_DOCTYPE.asp

    However I now use the HTML5 doctype
    Code:
    <!DOCTYPE html>
    As I write my sites in HTML 5 now.

    Hope that helps

    Andy

  • #3
    Regular Coder Doctor_Varney's Avatar
    Join Date
    Mar 2008
    Location
    Midlands, UK
    Posts
    649
    Thanks
    45
    Thanked 29 Times in 28 Posts
    HTML 5?! Where did that come from...? Where was 3 & 4?

    Must have missed them, trying to code with HTML 2.

    What browsers can read HTML 5 then?

    Thanks for the link but that's exactly the stuff I've read and already said I can't understand. I'm looking for explanations as to what the stuff in the doctype means. The stuff written about them gets me no closer to knowing which one I should use, which is why I'm asking the question here.

    Code:
    <!DOCTYPE html>
    Is that supposed to be a doctype? If so, where's all the other stuff?

    Dr. V
    Last edited by Doctor_Varney; 08-29-2010 at 09:12 PM.
    Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.

  • #4
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,263
    Thanks
    10
    Thanked 277 Times in 276 Posts
    Dr. V, keep in mind that this whole web technology is relatively new, and the languages used for the various pieces of it are still evolving. Thus you get new versions of HTML as people decide there are good new features to add, or as people decide a prior feature was a mistake and should be tossed out. Once you've got that in mind, you can see why there would be a "version" of the HTML language (current is 4.01), and that older versions still need to work because not everyone is going to go update their web sites to keep up to speed with old versions.

    So as a general rule, a web developer should be keeping up with whatever the current version is, and that means coding to a "strict" doctype. If you've got an older site that you don't want to bring up to date, they provide "transitional" (ie, "the code on this web site is not current, it transitions between old and new code") and "frameset" (specific for sites that use frames. As time moves on, something like <font> for example, is "deprecated" (meaning, "it's in the old language, we wish it weren't, it is no longer supported in the strict definition of HTML"). If you use those deprecated elements, you can, but you need to choose the transitional doctype to do it. You can look at any tag at W3schools (http://www.w3schools.com/tags/tag_font.asp for example) and see what DOCTYPE that tag is legal for, and should of course use the correct DOCTYPE for the style of coding you're going to write.

    HTHML 5 is coming down the pipe in the next years (10 years I think?) and the structure around the doctype is available to use even though many of the actual language changes need to be avoided because they're not implemented in browsers yet.

    Then there's the choice of XHTML vs. HTML, and XHTML has the same kind of story as I just listed above for HTML. If you're planning on implementing some XML components into your web page, you may want to look at that, but if your intention is to use HTML, then XHTML gets you nowhere.

    Dave

  • #5
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,665
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    A “document type declaration” basically tells the browser what kind of language you are using and it’s supposed to read. It contains a URL to a text document that contains the definition of all valid tags and attributes of that specific language.

    For example in <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> we see the URL “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd” which points to the file xhtml1-strict.dtd on the W3C server. If you look into this file you’ll see all the definitions of the tags and attributes that are allowed in that language.

    Theoretically you can create your very own doctype and define your very own tags and attributes. But this is only relevant for real XML based applications.

  • #6
    Regular Coder Doctor_Varney's Avatar
    Join Date
    Mar 2008
    Location
    Midlands, UK
    Posts
    649
    Thanks
    45
    Thanked 29 Times in 28 Posts
    Tracknut, thank you very much for taking the time. That was very concise and easy to understand.

    Thank you also, Stephan. I wondered why the doctype contained a 'url'! Now that makes sense and thanks for explaining.

    So, would I be right in thinking that if all I really intend for my page is words and pictures (no fancy scripts and computer languages) with a clever expanding div layout expressed in em measurements, that writing my HTML with proper closed tags etc could just be saved as .html and... job done?

    Like... I don't need to save it as .XHTML do I?

    Thanks again

    Dr. V
    Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.

  • #7
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Don't save as .xhtml because not all servers are configured to serve it properly.
    For argument's sake, you have a choice between two DTDs: HTML 4.01 Strict and XHTML 1.0 Strict. The only real difference between the two are that you have to write in an XML serialisation for XHTML. If you don't know what that means, go for HTML 4.01 Strict.

  • Users who have thanked Apostropartheid for this post:

    Doctor_Varney (08-30-2010)

  • #8
    Regular Coder Doctor_Varney's Avatar
    Join Date
    Mar 2008
    Location
    Midlands, UK
    Posts
    649
    Thanks
    45
    Thanked 29 Times in 28 Posts
    Ok!

    Dr. V
    Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.


  •  

    Posting Permissions

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