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 13 of 13
  1. #1
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts

    Exclamation Correct Doctype for HTML5 - or as near as possible.

    I have been playing aroung with html5 and css3 for a while, but I still do not understand what Doctype and header to use for the pages.

    A helpful explanation would be greatly appreciated.
    Frank - the headless wonder!
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #2
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    947
    Thanks
    0
    Thanked 130 Times in 129 Posts

  • #3
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    This isn't a general PC issue. Moving the HTML forum.
    OracleGuy

  • #4
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Yes. But I meant the whole of the heading from the top to the<head>
    Language and utf.

    I have a working header on my home page but I would like to be sure that it is complete. I have no real knowledge of this. I have always just c and p'ed from somebody elses site.

    Frank
    Last edited by effpeetee; 09-02-2010 at 06:48 PM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #5
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,470
    Thanks
    13
    Thanked 361 Times in 357 Posts
    HTML5: <!DOCTYPE HTML>

    XHTML5:
    - important: no DTD (the XML parser would try to validate the page, but will fail due to the incomplete DTD)
    - XML prolog if you’re not using UTF encoding
    - important: send an "application/xhtml+xml" Content-Type header from the server (or use the .xhtml extension)
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #6
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    The elements in the head of the document haven't really changed, Frank (: the only difference I can think of is that there's a different way you can declare your character encoding:
    Code:
    <head>
      <title></title>
      <meta charset="utf-8">
    </head>

  • #7
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,470
    Thanks
    13
    Thanked 361 Times in 357 Posts
    bear in mind that server settings overwrite page settings, so if you set a Content-Encoding header on the server, the content encoding in your <meta> tag gets ignored (there are some headers automaticly set by the server, e.g. the Content-Type header). nevertheless it’s good practice to always include the headers in the page as well.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #8
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Thank you all. This is what I am using now.

    Code:
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>Web coders resource. Uses javascript,HTML5 and CSS3</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
    </head>
    Frank
    Last edited by effpeetee; 09-03-2010 at 11:22 AM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #9
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    947
    Thanks
    0
    Thanked 130 Times in 129 Posts
    It is a valid and complete HTML5 <head> except 2 small things:
    Code:
     lang="en"
    is not HTML5

    and (according to the references) The <meta> goes before the <title>
    ------------
    And you can shorten it a bit

    in
    Code:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
    the red parts is optional.

    so
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset=utf-8">
    <title>Web coders resource. Uses javascript,HTML5 and CSS3</title>
    </head>
    is the best

  • #10
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,470
    Thanks
    13
    Thanked 361 Times in 357 Posts
    Quote Originally Posted by lerura View Post
    It is a valid and complete HTML5 <head> except 2 small things:
    Code:
     lang="en"
    is not HTML5
    wrong

    Quote Originally Posted by lerura View Post
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Web coders resource. Uses javascript,HTML5 and CSS3</title>
    </head>
    is the best
    at least fix your typos!
    Last edited by Dormilich; 09-03-2010 at 02:01 PM.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #11
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    850
    Thanks
    11
    Thanked 79 Times in 77 Posts
    This is standard for HTML 5 in my web editor:
    Code:
    <!DOCTYPE html>
    <html lang="en"><head>
    <meta charset="utf-8">
    <meta name="created" content="Fri, 03 Sep 2010 14:32:26 GMT">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <title></title>
        
    <!--[if IE]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    </head>
    <body>
    
    </body></html>
    Add anything else you think you need. The script reference is currently needed.
    ☠ ☠RON☠ ☠

  • #12
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Quote Originally Posted by Major Payne View Post
    This is standard for HTML 5 in my web editor:
    Code:
    <!DOCTYPE html>
    <html lang="en"><head>
    <meta charset="utf-8">
    <meta name="created" content="Fri, 03 Sep 2010 14:32:26 GMT">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <title></title>
        
    <!--[if IE]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    </head>
    <body>
    
    </body></html>
    Add anything else you think you need. The script reference is currently needed.
    Thank you Major Payne.
    Works fine.

    Incidentally, what is you web editor?

    Frank
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #13
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    850
    Thanks
    11
    Thanked 79 Times in 77 Posts
    Quote Originally Posted by effpeetee View Post
    Incidentally, what is you web editor?

    Frank
    I have several free and paid ones. The current one I am using is CoffeeCup's HTML Editor 2010 SE which generates the HTML 5 file if I choose that doctype.
    ☠ ☠RON☠ ☠


  •  

    Posting Permissions

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