9

The websites I've designed had no problem before but now I see DOCTYPE line red in Firefox 11. There is no problem in validation. I changed encoding to UTF-8 without BOM but problem still exists.

http://validator.w3.org/check?uri=genelvana.com

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
HasanG
  • 12,734
  • 29
  • 100
  • 154
  • 1
    firefox 10.02 says its valid. do you use any extensions that may cause invalidity? – Taha Paksu Apr 07 '12 at 10:43
  • 1
    and firefox 11 validated the page too. it's probably caused by one of your extensions. – Taha Paksu Apr 07 '12 at 10:44
  • I removed all add-ons, reinstalled firefox, uninstalled Kaspersky Internet Security but still same... – HasanG Apr 07 '12 at 11:19
  • @HasanGürsoy I'm having this same issue. Here is my test file: http://matthewpavkov.com/dev/temp/firefox-validation-issue.html The `doctype` appears in red when viewing the source in Firefox 11. – matthewpavkov Apr 19 '12 at 16:52
  • 1
    also see this related Stack Overflow article: http://stackoverflow.com/questions/10775005/why-firefox-highlights-html-transitional-doctype-in-red – gcbound Aug 13 '12 at 21:09

4 Answers4

5

Isn't it because Transitional doctype isn't really valid anymore unless you are using legacy code?

Surely now if you build a website now, should you be using strict or html5?

Charles Menguy
  • 40,830
  • 17
  • 95
  • 117
  • 1
    What do you mean it's not really valid anymore? Of course it's still valid: - http://www.w3.org/QA/2002/04/valid-dtd-list.html - http://bit.ly/HY1KnR - Still, I do agree that `strict` or `html5` doctypes should be used. – matthewpavkov Apr 20 '12 at 15:27
  • bad english sorry. It very old fashioned to use transitional, is my point. Should no be use anymore unless old code factors into project. – David Blaine Apr 20 '12 at 15:58
  • that link is from 2002...foonjobi! –  Aug 08 '13 at 00:39
3

Same here while Fx6 didn't color it in red.

While hovering this first line, a tooltip appears saying

Almost standards mode doctype. Expected "<!DOCTYPE html>".

You can safely forget this "advice" IMHO. The important thing to do is choosing a valid doctype and then write code that is conformant to this doctype, as you already do. No browser cares about what follows html so the contrary is true too: no browser cares if there's something after html ;)
Of course, if you use HTML5 elements and technologies (nav element, canvas or whatever) then yes use the HTML5 doctype.

FelipeAls
  • 21,711
  • 8
  • 54
  • 74
  • 2
    That's false. Browsers do care what comes after the `html`. That's what the "almost standards" mode part means. This doctype is triggering a mode which is not quite standards-compliant, for various historical reasons. So if you actually want standards-compliant rendering, you don't want to be using this doctype. – Boris Zbarsky Apr 08 '12 at 02:02
  • From now on I'm using – HasanG Apr 19 '12 at 20:02
2

It's not so much an error, as it is a warning. Firefox is simply alerting you that the DOCTYPE you are using, XHTML 1.0 Transitional, triggers Almost standards mode, instead of Standards mode.
If you want the page to be displayed in Standards mode, all you need to do is change the DOCTYPE to either XHTML 1.0 Strict or HTML 5.

Slartibartfast
  • 338
  • 2
  • 9
0

you may have some CSS validation errors like fractional pixel values or missing unit declarations like these :

div {left:3.545253px;}

or

div {left: 50;}

these would cause the html doctype validation errors. Check your CSS files and jQuery CSS settings if you have any.

Taha Paksu
  • 15,371
  • 2
  • 44
  • 78
  • I don't get any errors on another PC. Probably the problem is not related with code. – HasanG Apr 07 '12 at 11:29
  • http://www.sitepoint.com/forums/showthread.php?811328-What-DOCTYPE!-to-use-for-my-site says if you don't have any html5 markup in your scripts and use this doctype, it'll give validation errors. try adding an empty `
    ` somewhere on your code.
    – Taha Paksu Apr 07 '12 at 11:35