What is Doctype and why do I care?
Doctype declares what and how a browser should rending a webpage.It is because of this that it should be the first tag on your webpage … and it should be included always!
A bit of emphasis is added there because declaring the it is a very important starting point to communication on the web. In email code development it was easy to somethimes skate by without it until ISPs (internet service providers) started to use not having it declared as a queue for spam … lesson learned.
Knowing how to use Doctype’s can actually really cool, especially with HTML5. With HTML5 you can simply declare the it and then the browser will read html tags that are depracated for HTML 4.01 and XHTML STRICT and fix basic HTML Code issues such as if a tag wasn’t closed.
Further reading on Doctypes with W3C Schools
Code Samples: Doctype
<!DOCTYPE html> <!-- This is HTML 5--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- This is HTML 4.01 Transitional --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- This is XHTML 1.0 Strict -->