Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: comment tag help?
06-09-2012, 03:35 PM #1
- Join Date
- Nov 2011
- Thanked 0 Times in 0 Posts
comment tag help?
Where is the earliest location you can place a comment tag in a page's code? I've heard you shouldn't place anything before doctype, but how soon after that can it be placed, without causing any possible bad or buggy behavior? For instance, could a comment tag exist between the doctype and opening html tag? Also, can comment tags be placed at the very end, after the closing html tag?
Last edited by resin; 06-09-2012 at 05:31 PM.
06-09-2012, 11:11 PM #2
- Join Date
- Sep 2005
- Sydney, Australia
- Thanked 624 Times in 614 Posts
Since the comment tag is an HTML tag it should only be used inside of the <html> tag. Anything outside the <html></html> isn't HTML by definition. (the <DOCTYPE> tag is SGML).
Browsers might accept a comment outside of the HTML but there is nothing to say that they have to - which is why versions of IE not recognising the DOCTYPE tag when it was preceded by an illegally placed comment cannot be considered to be a bug.