Which DOCTYPE to use?

20 replies
  • WEB DESIGN
  • |
Hi,

I am using this DOCTYPE, which one is best to use?
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
It's an English language site, but occasinally I need Spanish/Eastern European/German characters to be dispalyed...

What would you recommend?
#doctype
  • Profile picture of the author KirkMcD
    The doctype deals with what version of html you are using, so you pick the one based on that.
    {{ DiscussionBoard.errors[7609883].message }}
  • Profile picture of the author shipwrecked
    Where can I find that information?

    I am coding HTML in Notepad++ and I'm using various HTML codes, so I'm unsure about this thing... honestly: I only started paying attention to this DOCTYPE think about 2 weeks ago...
    {{ DiscussionBoard.errors[7609899].message }}
  • Profile picture of the author ltrain_riders
    Just use: <!DOCTYPE html>

    It's for HTML 5. Here's a list of tags you can use with each doctype.

    http://www.w3schools.com/tags/ref_html_dtd.asp
    {{ DiscussionBoard.errors[7609983].message }}
  • Profile picture of the author blogfreakz
    Originally Posted by shipwrecked View Post

    Hi,

    I am using this DOCTYPE, which one is best to use?
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    It's an English language site, but occasinally I need Spanish/Eastern European/German characters to be dispalyed...

    What would you recommend?
    I used same, some of my client used special character like in denmark language, it's seems no problem.. just include

    Code:
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    you can visit this link

    HTML Codes - Special Characters for Spanish - ASCII Table - Spanish HTML Codes
    {{ DiscussionBoard.errors[7610252].message }}
  • Profile picture of the author Istvan Horvath
    The doctype and the languages (character set) have nothing in common.

    Doctype - as it was said above - refers to the (X)HTML version used in your file.
    For a long time the default WP themes came with XHTML 1.0. Lately they switched to HTML 5.0.

    The encoding, for different languages, is set by one of the meta tags in the <head> section; see above. Use always utf-8 and all the languages, all the special characters will be displayed correctly. (And you won't even need those special characters: just switch your keyboard to another language and you'll be fine - I always have installed on my keyboard 4-5 languages and I never have to use that special characters complication...)
    Signature

    {{ DiscussionBoard.errors[7610460].message }}
  • Profile picture of the author shipwrecked
    So, should I still use this one?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    {{ DiscussionBoard.errors[7616937].message }}
    • Profile picture of the author David V
      Originally Posted by shipwrecked View Post

      So, should I still use this one?

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      That depends on how your coding the site.
      If it's XHTML like declared then yes.
      If it's HTML5 then no.
      If it's XHTML strict, then no....
      and so on.....

      and just as "Istvan Horvath" stated already....
      "The doctype and the languages (character set) have nothing in common."

      How are you coding the site? Answer that then declare the doctype.
      {{ DiscussionBoard.errors[7617238].message }}
  • Profile picture of the author shipwrecked
    I am coding my site manually in Notepad++

    I am using various HTML and CSS codes, didn't pay attention to the HTML 5 or earlier versions. So I'm pretty much using commands, codes I learned, but not sure what version of HTML that is... I didn't know it counts - so long the browsers can read and display it...

    There is no XHTML in my code. Perhaps in 3rd party scripts (e.g. commenting scripts?)... that I add to my pages?
    {{ DiscussionBoard.errors[7619665].message }}
  • Profile picture of the author ltrain_riders
    You should read up on HTML vs XHTML if you don't know the difference. You are probably coding in XHTML and don't even realize it.

    XML syntax rules are far more rigorous than HTML. As a result, XHTML makes authors work more precisely, having to address issues such as:
    - all elements and attribute names must appear in lower case
    - all attribute values must be quoted
    - non-Empty Elements require a closing tag
    - empty elements are terminated using a space and a trailing slash
    - no attribute minimization is allowed
    - in strict XHTML, all inline elements must be contained in a block element

    I would use <!DOCTYPE html> and code for HTML 5. It works with HTML 4 and I believe uses the XHTML standards. Only a few new features (<tags/>) of HTML 5 are not supported by every web browser. IE is the browser that has the least support, but you probably won't be using the <tags/> that aren't supported anyways.

    Read up on HTML 5 here.

    Also, drop Notepad++ and find yourself a better IDE.
    {{ DiscussionBoard.errors[7619837].message }}
    • Profile picture of the author Michael71
      Originally Posted by ltrain_riders View Post

      Also, drop Notepad++ and find yourself a better IDE.
      LOL

      Why the hell would you need an IDE for HTML/CSS/JS?

      It's simple text, nothing more...
      Signature

      HTML/CSS/jQuery/ZURB Foundation/Twitter Bootstrap/Wordpress/Frontend Performance Optimizing
      ---
      Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu

      {{ DiscussionBoard.errors[7671229].message }}
      • Profile picture of the author ltrain_riders
        Originally Posted by Michael71 View Post

        LOL

        Why the hell would you need an IDE for HTML/CSS/JS?

        It's simple text, nothing more...
        What the... :confused:

        Simple text yes, but the OP is having problems writing this simple text using a doc type. Having a good IDE will help the OP when writing HTML code, because a good IDE will auto complete tags, show you which attributes are available, syntax highlighting, apply source formatting, not to mention provide a quick preview of the design you are coding.

        So yea, if the OP is having trouble writing valid code, then maybe he should consider and IDE. :rolleyes:
        {{ DiscussionBoard.errors[7673624].message }}
  • Profile picture of the author BerlinSianipar
    Use <!DOCTYPE html> to embrace the features of HTML5, the latest HTML version.
    {{ DiscussionBoard.errors[7619885].message }}
  • Profile picture of the author shipwrecked
    I simply use <!DOCTYPE html> ... seems to be fine... only that notepad++ turns it to black color.

    This is not displaying foreign and some other characters:
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />

    (gives me weird question mark characters instead)

    So I turned back to use this:
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    Seems to work fine...

    Not sure... should I code like this:

    &#201
    ;

    For it to appear like this?

    É

    Not sure that all of you can see that, because I did get some wicked characters from other computers.
    {{ DiscussionBoard.errors[7621593].message }}
    • Profile picture of the author Lloyd Buchinski
      Originally Posted by shipwrecked View Post

      I simply use <!DOCTYPE html> ... seems to be fine... only that notepad++ turns it to black color.
      That probably means you are using an older version of np++. The very latest, above 6.0, have a problem with no 'edit with np++' in the right click menu. You can get along fine without it by dragging and dropping files on it, but I installed version 5.9.x to get the context menu.

      Originally Posted by shipwrecked View Post

      This is not displaying foreign and some other characters:
      <meta http-equiv="content-type" content="text/html;charset=utf-8" />

      (gives me weird question mark characters instead)

      So I turned back to use this:
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

      Seems to work fine...
      The only times I had the question mark problems with the utf-8 charset was pasting text from a Word doc. The charset=iso-8859-1 will handle that. I wanted to use utf-8, so I set Word to use the straight quotes instead of the curly ones, and that sort of stuff.

      I don't use Word for anything to do with copy and building now, except for a grammar suggestions and spell check after the page is done.
      Signature

      Do something spectacular; be fulfilled. Then you can be your own hero. Prem Rawat

      The KimW WSO

      {{ DiscussionBoard.errors[7630742].message }}
  • Profile picture of the author oknoorap
    for now and for the future please use
    <!DOCTYPE html>

    HTML5 technology is for the future, and the technology itself is never backward.
    {{ DiscussionBoard.errors[7627522].message }}
  • Profile picture of the author Istvan Horvath
    Your "wicked characters" are NOT caused by the right encoding but, most likely, by the improper use of your editor.

    In a similar editor (PSPad) that I use for writing and editing HTML, PHP, CSS etc. files I do have an option to change the encoding of the file itself when writing the code. That's the first step.

    On older computers and older browsers you have to check zillion times that the OS version and the browser both understand different character encoding and can display them. Older browsers tend to not "switch" to the character encoding defined in the head... and then you have the weird idiotic characters.

    Trust me, I was one of the first bloggers writing about multilingual blogging and was involved in many things related translation and correct character encoding, including their display in browsers. I know what I am talking about...

    [Az iso-8859-1 NEM jó a magyar betűknek vazzeg... nem tud hosszú ő-t és ű-t]
    Signature

    {{ DiscussionBoard.errors[7627633].message }}
  • Profile picture of the author shipwrecked
    I tried using this:
    <!DOCTYPE html>

    But the W3 validator gave an error and said something like it cannot read (what was supposed to be HTML 5) and didn't show anything else.

    Apart from that, I think it's the iso-8859-2 that works for Central European languages...

    Tried UTF-8, but again: validator gave me some error, so I switched all back.

    Anyway - I'm more concerned about the DOCTYPE. I have a site 100 % in english, some (few, like 2-3 %) foreign words (city names, peoples' names) in it (that's for charset).

    But this HTML 5 DOCTYPE gives me an error. Hmmm...
    {{ DiscussionBoard.errors[7629825].message }}
  • Profile picture of the author shipwrecked
    OK, so I will use the ido-8859-1 and will use a DOCTYPE like this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    As I've understood, the "tranny" is not good, so I'll pick the "strict". Different doctypes gave me different errors.

    As for special characters - which I won't have too many - I will use ASCII...

    I guess this should do it.
    {{ DiscussionBoard.errors[7659458].message }}
    • Profile picture of the author Istvan Horvath
      Originally Posted by shipwrecked View Post

      As I've understood...
      You didn't. I mean you haven't understood anything.

      One can NOT change the doctype arbitrarily and hope for a "better" result.

      If you choose a doctype - you must code the file accordingly!

      There are different rules for different doctypes, and that's the part you - seemingly - don't get. Or don't want to understand...
      Once again, some recommended documentation:
      HTML doctype declaration
      W3C QA - Recommended list of Doctype declarations you can use in your Web document

      BTW, any 'strict' type is always more demanding and leaves less room for bad code - in other words, when picking strict you should know perfect coding!!!

      The validator looks at your doctype and compares your code with the standards for that doctype. Of course, if you change the doctype (which you should NOT do, unless you rewrite the code), it gives you different errors.

      You were already told several times in this thread: the doctype should be based on how you are coding your site/document. But you decided not to listen and trying to "outsmart" the validator. Good luck!
      Signature

      {{ DiscussionBoard.errors[7659661].message }}
  • Profile picture of the author Michael71
    An IDE is not a garant for good code...

    Before starting to code a website you should KNOW what is needed.

    Notepad++ and Zen Coding plugin is all I need.
    Signature

    HTML/CSS/jQuery/ZURB Foundation/Twitter Bootstrap/Wordpress/Frontend Performance Optimizing
    ---
    Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu

    {{ DiscussionBoard.errors[7673742].message }}

Trending Topics