• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » Html » Tutorial » HTML Doctype Declaration
Next →
← Prev

HTML Doctype Declaration

By Dinesh Thakur

Doctype is a piece of code that goes in the first line of an HTML webpage. Don’t worry about what’s in it just recognize that this line is a Doctype. And I said ‘a’ Doctype as the fun part is there are a whole bunch of them. Which is why it is so important for you to understand which type pertains to your website.

About Doctypes : Doctype is an abbreviation for ‘Document Type Object’ which basically summarizes that your webpage, while in document type, is actually and object and thus treated so. As you can see without this piece of code your browser may not know if your website is and object, what form it takes, and thus may be very confused as to how to render it.

Luckily IE and Mozilla will try very hard to render your page correctly but why tale a chance that thy get it right all the time? Definition- ‘Render’: When programmers talk about browsers rendering they mean exactly how the browser complies the code, what standards it follows, and how the code is projected on the screen (eg. is it what the programmer intended?).

Using a Doctype will ensure that all major browsers (IE, Mozilla, Safari, Opera) will render your website exactly the same every time it is viewed. Also for example Internet Explorer (R) 6.0 will render your site the same as 7.0. So now that you realize the importance of Doctypes, where do you head from here? Additional Information (before you begin): Doctypes are created and stored on the World Wide Web consortiums servers (W3C.org). They are in fact links to actual documents which set the standards for how browsers use code you implement in your website.

For example a Doctype will let the browser know how to calculate where an image goes on the screen when a programmer specifies its location in a percentage. Without this information the browser will revert back to its standard formatting. For example if you specify an images location as 20% to the right and your div element 22% to the right, it may look fine in mozilla and overlap in IE (and vice versa).

Thus you can see in order for your website to be rendered the same in every browser you must include a relevant Doctype. Determining the correct Doctype : Determining which Doctype you should use for your website is not very difficult as long as one MAJOR rule is followed. Don’t use the short version:

The DOCTYPE declaration, mandatoryin any document, specifies the type ofdocument that willbe created and theDTD to which itwillcomply. The first partof the statement:
<! DOCTYPE html PUBLIC “– / / W3C / / DTD XHTML 1.1 / / EN” indicatesthe generic nameof the DTD. Html part gives the name ofthe root element document. The second part:

http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd

state the address xhtml11.dtd file that contains the DTD itself. To use variants of XHTML 1.0, we have a choice between the DOCTYPE declarations following:

<! DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" http://www<span< a=""> style="color:#008c00; ">.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd 

which corresponds to the version XHTML 1.0 strict, XHTML 1.1 and before it is practicallyidentical. This is the most rigorous versions of XHTML 1.0.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd

It allows the use of obsolete elements present in older versions ofHTML, such as <font> or <center> absolutely not recommended for years.This DTD has been created by the W3C as to ensure compatibility with documentsHTML developed with HTML 4 Transitional, itself created to ensure compatibilitywith HTML 3.2. Use this DTD now would be an aberration and hypocrisyto create the impression that it is XHTML. It is the very negation of the spirit ofXHTML, no offense to some, and I will not quote it from memory as discouragingformally its use.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd "> 

You’ll also like:

  1. difference between declaring a variable in the General Declaration section of a standard code module and declaring variable in the general declaration section of a form code module?
  2. What is HTML?
  3. The hr tag in HTML
  4. Function Declaration or Prototype in C
  5. Declaration and Initialization of Pointers in C
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

HTML Tutorials

HTML Tutorials

  • HTML - Home
  • HTML - History
  • HTML - Lists
  • HTML - Unordered List
  • HTML - Ordered Lists
  • HTML - Frame Tag
  • HTML - Input Type
  • HTML - Input Type="File"
  • HTML - Input Type="Hidden"
  • HTML - Form Tag
  • HTML - Img Tag
  • HTML - Anchor Tag
  • HTML - Table Tag
  • HTML - Span Tag
  • HTML - Button Tag
  • HTML - Doctype
  • HTML - Fieldset Tag
  • HTML - Links Tag
  • HTML - Drop Down Menu
  • HTML - Accesskey
  • HTML - Cgi
  • HTML - Post Method
  • HTML - Background Image
  • HTML - Text Area
  • HTML - TabIndex
  • HTML - Align Center
  • HTML - Address Tag
  • HTML - Thumbnails
  • HTML - Marquee Tag
  • HTML - Line Break
  • HTML - Blockquote
  • HTML - HR Tag
  • HTML - Image Center
  • HTML - Center Text
  • HTML - Link CSS
  • HTML - Html Vs Html5

Other Links

  • HTML - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW