Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

What does a doctype do?

user-image
Question ajoutée par Rehan Farooq , WEB DEVELOPER/DIGITAL MARKETING EXPERT , Upwork
Date de publication: 2016/01/12
Tomasz Modrzejewski
par Tomasz Modrzejewski , Python Developer , Freelancer

Information on computers save every day. Not all will have to survive for years, but there is a lot of such (such as company information, statistical data, weather reports, court records, etc.) that must endure much more. Save as DOC today seems like a good idea — all have MS Word, all programs read MS Word ... Hmm ... years ago it was a good idea to save the same TAG. What are open file formats? Let us pause for a brief summary. We want to save files in such a way as to be able to easily open and edit them on any platform, to be independent of the particular manufacturer or the owner of the patent (and preferably give some format of Supervision Organization for Standardization, for example. ISO) and-if need be-be able to independently "pull" information from the old file. We need an open standard files. To the file format could be named "open standard" must meet several criteria: should not be fortified any patents or licenses — thanks to this we are not dependent on a specific company, nobody can forbid or format use the us suddenly require licensing fees for the use of it; its full documentation should be publicly available — thanks to everyone will be able to verify that the format does not contain glaring errors or vulnerabilities (very important if you store important information); should be considered by an international standardizing body (eg. ISO) — to different manufacturers not tried to "pull" in your site crashing it on dozens of incompatible with each other; should be "human readable" (i.e. text, not binary) — as a last resort, you can "pull" the information using a plain text editor. Examples of open formats An example of such an open format is HTML. On the development of W3C watches, so that the language is growing along with the development of technology. Technical specification is available publicly to anyone — anyone can figure out how it works and use it. Thanks to an HTML document can be viewed and modified in the massive amount of programs — from the standard Notepad after advanced package of Macromedia Dreamweaver. Open formats is not only text — a bitmap graphics we can write in the form, for example. PNG files (Note: this format is not only text, binary), and vector art for example. in the form of SVG files. "Open" can also be considered as a JPEG, and PDF.

Utilisateur supprimé
par Utilisateur supprimé

doctype or  DTD is a Document Type Definition.The DTD is an instruction that associates a particular SGML(Standard Generalized Markup Language) or XML document for defin the type of document .

 

exemple : for create XHTML Mobile Profile DTDs  you need to insert this instruction in first place

 <!DOCTYPE html PUBLIC   "-//WAPFORUM//DTD XHTML Mobile1.0//EN"   "http://www.wapforum.org/DTD/xhtml-mobile.dtd">

The doctype declaration should be the very first thing in an HTML document, before the tag. The doctype declaration is not an HTML tag; it is an instruction to the web browser about what version of the markup language the page is written in. The doctype declaration refers to a Document Type Definition (DTD).

Ali Joudeh
par Ali Joudeh , Senior Full Stack Developer , Derq Systems FZ LLC

In HTML5, the only purpose of the DOCTYPE is to activate full standards mode. Older versions of the HTML standard gave additional meaning to the DOCTYPE, but no browser has ever used the DOCTYPE for anything other than switching between quirks mode and standards mode.

 

Believe it or not! The layout Engine used by Web Browsers to render web pages uses3 different modes & can still render legacy old HTML!Long story short ...During the old browser wars, there were no stanndards in rendering HTML content into browsers, so web pages were written in two versions, Netscape Navigator and Internet Explorer, developers had to write a version of thier page that works for IE & the other for Netscape, then when the W3C (World Wide Web Consortium) took over defining Web Standards, Browsers were simply not able to use the new standards to render the old pages written for Legacy browsers.

 

Therefore, browsers introduced two modes to treat new standards defined by the W3C & support older html as well.There are now three modes used by the layout engines in web browsers: quirks mode, almost standards mode, and full standards mode. In quirks mode, layout emulates nonstandard behavior in Navigator4 and Internet Explorer5.

This is essential in order to support websites that were built before the widespread adoption of web standards. In full standards mode, the behavior is (hopefully) the behavior described by the HTML and CSS specifications. In almost standards mode, there are only a very small number of quirks implemented.

 

In Firefox, select View Page Info from the context menu, and look for Render Mode.If you use DOCTYPE you will see Standards Mode, if you remove the DOCTYPE, you should see Quirks Mode

q mode

 

In IE, you should find that in Developer Tools

IE

 

To see the differences between the2 modes, see this link

Quirks Mode behaviour in FireFox

 

Make sure you always use the DOCTYPE so your browser better complies with the new Standards.

هاشم المشارقة
par هاشم المشارقة , Key Account Manager , Advanced United Systems Ltd. ( A member of Taj Holding Group)

DOCTYPEs are required for legacy reasons. When omitted, browsers tend to use a different rendering mode that is incompatible with some specifications. Including the DOCTYPE in a document ensures that the browser makes a best-effort attempt at following the relevant specifications.

Fadi Alkhateeb
par Fadi Alkhateeb , Senior Front End Developer , NexTwo

Simply doctype tell the browser how to deal with webpage: in other words its declaration for browser to tell what type of page you are dealing with and what conditions to apply.

Abdulelah Fallatah
par Abdulelah Fallatah , Tech-Support Specialist & Programmer , Al-Rayan Colleges

It's an element inside the DTD file.

 

This element tells any browser (Google Chrome, Opera etc) that the document opened by it is an HTML file.

More Questions Like This