Skip to main content

The Doctype! Is this Document HTML5?

After all of the learning to set up a basic html5 page, we suddenly are now going to tell the browser that we are using html5 by using the "doctype element". The doctype* as the name suggest specifies the document type. Being an everyday evolving language, html has several versions and associated technologies and every individual has open options to use any of them according to their preference. The doctype defines information like which version of the html is used to write the document etc.

But as of this course of time html5 is the new common among developers and it greatly simplifies the doctype of the html document and shrinks it down to just a simple statement against the old long and terrifying DTD and Xhtml declarations (if you don't know what they are, don't worry; you don't need to).

The doctype is defined at the very beginning of the document even before the html element in the webpage. Now since, the doctype is a special element which is just for the purpose of defining the type of the html document, it has a sightly different syntax than other elements.
The doctype tag is surrounded by angle brackets as usual but starts with an exclamation mark '!' followed by the doctype declaration as "html". That's it.

<!DOCTYPE html>
(the doctype can also be written in smallcaps, it won't make a difference)

Test Code : ( The html5 page is ready to go )


<!doctype html>
<html>
<head>
<meta charset = "UTF-8">
 <title>
My page still has a title within head tag
</title>
</head>
<body>
I can see my text appearing in the main content area.
All the content in the webpage is mentioned in this tag
</body>
<html> 



Note: Similar to meta tag there will not be any difference in appearance of the page in the browser but now you specified the use of html5 and the new html5 elements can be used explicitly.




Comments

Popular posts from this blog

Turn your Linux into a wifi hotspot for Android and Windows phones! (Ubuntu and Linux Mint)

This is one of the biggest problem linux users face i.e. to share your ethernet connection over wifi for your android or windows mobile device. Here is a simple step process to easily set up a hotspot on your laptop to connect your mobile devices to surf on the go! 1. We need to install 2 additional tools to make our hotspot work: hostapd(hotspot server)   dnsmasq(dns dhcp server) Open the terminal (Ctrl+alt+T) and type:  sudo apt-get install hostapd dnsmasq and press enter. Wait for them to install.   2. Stop these services and prevent them from starting on system start up. To do that; open a terminal and type each command per line and press enter: sudo service hostapd stop sudo service dnsmasq stop sudo update-rc.d hostapd disable sudo update-rc.d dnsmasq disable   3. Now we need to set the configuration files for both the installed tools. To open the config file of dnsmasq ; open a terminal (Ctrl+alt+T) and type sudo gedit /etc/dnsmasq.con...

How to program pyramids using loops

While programming, beginners do come up with some form of pyramid to be printed using any kind of loops in most programming languages. This video presentation clarifies the basic concept behind coding these pyramids in any programming language and explains how these loops can be created and manipulated to obtain different outputs. If you visualize properly, these pyramids are mere TABLES, combination of rows and columns. Having said that, we can understand that there needs to be a logic to control both rows and columns of the table and do that in such a way that the desired pattern is obtained. For doing so, we use two loops in case of a simple pyramid , one for the rows and other for the columns. Since, the general convention is to represent the rows prior to columns , assuming the same, the outer loop tracks the rows and the inner loop tracks the columns. The outer loop is fairly simple and is defined starting from 0 or 1 depending on your preference in most of the cases ...

How to program pyramids using loops - 2

In this video tutorial, two of the more patterns have been discussed that relates to the similar pattern problems. What's different about these are that they also include spaces before the stars as a part of the pattern to be printed. Having this extra sub pattern to track spaces  in the desired pattern requires an extra loop to track and control it . For a brief review, We discussed that these patterns if observed carefully are just representation of tables i.e. a combination of rows and columns . And few of the cells in that table are populated with some data according to a logically programmed algorithm with represents a pattern. In these cases, the red triangles shows us the spaces represented by "sp" and therefore unlike the previous pattern these need to be managed by the loop as they occur before the stars in the pattern. So, taking the same approach of rows and columns managing loops, we will have an outer loop that tracks the rows which will start at 0...