html5 - Whether browser recognize document HTML version -
i have html document written in html 4. used required attribute html 5 worked surprise. saw error red border when input empty. think browser recognized document html 5 document , ignored doctype. question is, how browser google chrome recognize html document version.
thanks hints.
<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <style> input:invalid { border: 2px dashed red; } input:valid { border: 2px solid black; } </style> </head> <body> <form> <label for="name">name</label> <input id="name" name="name" required> <button>submit</button> </form> </body> </html>
how browser google chrome recognize html document version
they don't. parse html.
(the exception being doctype switching, uses doctype, switch between "good" , "1990s" behaviour, not detect version.)
Comments
Post a Comment