HTML & CSS
I am using Colorbox and other JQuery libraries in my project.
Doctype is important for JQuery library like Colorbox.
I want to know importance and why we need doctype in document.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Basically, if you have a doctype on your page, the browser sees it and thinks—OK, this web designer has some clue about what he's doing, so we'll render the page according to the prevailing web standards. If there's no doctype, the browser might decide to display your page in "quirks mode", as if it were built last century, and thus your layout will break in certain ways.
It doesn't really matter which doctype you use. These days, it's common to use the so called "HTML5" version, which is more of a generic doctype:
which ends up like this in the document:
Doctype help browser understand if the page is written using strict, transitional or frameset type html. Depending upon this declaration the page code will be validated in w3c validator.
Also doctype is necessary to make few elements of html work properly. It is an idea practice to include the doctype in your html page.
Doctype specify the web standard you have used for writing code of your website.Each doctype has different rules and constraints