How does a Web browser differentiate between HTML5 and HTML4?
DOCTYPE for HTML4 is much longer as it is SGML-based. However, the reference to DTD has been withdrawn from HTML5 <! DOCTYPE> declaration, since it is not based on SGML. Therefore, there is no need to tell the browser about Type Definition of Document and with HTML5 a simple <!
According to w3schools, the following DOCTYPE defines a document as HTML5:
<!DOCTYPE html>
And the three types of HTML4 are defined by the following DOCTYPE declarations:
HTML 4.01 Strict
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4.01 Transitional
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
HTML 4.01 Frameset
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With