• Menu
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

JavaBeat

Java Tutorial Blog

  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)

HTML5 Doctype

March 8, 2014 //  by Krishna Srinivasan//  Leave a Comment

The <! DOCTYPE HTML> Declaration

The <! DOCTYPE HTML> declaration is an important thing in HTML document before declaring <html> tag. The DOCTYPE is an instruction that associates particular SGML or XML document with document type definition.

HTML 4.01 DOCTYPE

In HTML 4, <! DOCTYPE HTML> refers to DTD because it is based on SGML. The DTD specifies the rules for the markup language. HTML 4 DOCTYPE describe the root element and provides two ways for finding the DTD namely- a URL and code for finding a local copy. HTML 4 comes in three different flavors each with different DOCTYPE.

HTML 4.01 Strict

The Strict DTD does not allow presentation elements like font, link targets. Instead we can use Cascading Style Sheets for that. Framesets are not allowed in this DTD. It can look like as follows :

<!DOCTYPE HTML PUBLIC  “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>

HTML 4.01 Transitional

This DTD allows presentation and deprecated elements like font, link targets and all HTML elements and attributes. It does not allow framesets. It can look like as follows :

<!DOCTYPE HTML PUBLIC  “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>

HTML 4.01 Frameset

It allows the use of frameset contents. It is equal to HTML 4.01 Transitional which uses frames for documents. . It can be look like as follows :

<!DOCTYPE HTML PUBLIC  “-//W3C//DTD HTML 4.01 Frameset//EN” “http://www.w3.org/TR/html4/frameset.dtd”>

HTML 5 <! DOCTYPE HTML>

HTML 5 <! DOCTYPE HTML > is used to refer to Document Type Declaration (DTD) and written before the <html> start tag. It specifies which language and which version of the document we are using. In HTML5 we can specify DOCTYPE as follows :

<! DOCTYPE HTML>

HTML 5 Doctype Example

Following a simple example specifying the use of <! DOCTYPE HTML > :

<! DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Simple Example</title>
</head>
<body>
	Welcome to JavaBeat
</body>
</html>

Note that the <! DOCTYPE HTML> declaration is case-insensitive. HTML5 recommends that tag must be included at the top of all HTML documents.

 

Next Tutorial :: HTML5 Events

Category: HTMLTag: HTML5

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Previous Post: « Java Strings, StringBuilder, StringBuffer
Next Post: HTML5 Events »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow Us

  • Facebook
  • Pinterest

FEATURED TUTORIALS

New Features in Spring Boot 1.4

Difference Between @RequestParam and @PathVariable in Spring MVC

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Introductiion to Jakarta Struts

What’s new in Struts 2.0? – Struts 2.0 Framework

JavaBeat

Copyright © by JavaBeat · All rights reserved
Privacy Policy | Contact