New to HTML 5? First steps

If you have some experience with previous versions of HTML such as version 4.01 but new to HTML 5, here are the first things you need to learn. So what’s new with HTML 5?

1. The doctype definition at the top of the file is simplifed:

The doctype definiton for HTML version 4.01 was something similar to the following

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

The doctype in HTML 5 is now simply:

<!doctype html>

2. The content meta tag is also simplified

Before HTML 4

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

After HTML 5

<meta charset="utf-8">

All browsers old and new already understand this meta description to my knowledge, so you can use it on any page and it just works.

3. The <link> tag within the <head> element slightly changed

What was before HTML 5

<link type="text/css" rel="stylesheet" href="style.css">

is now

<link rel="stylesheet" href="style.css">

4. The <script> tag can lose the type attribute for JavaScript

With HTML5, JavaScript is now the standard and default scripting language, so you can remove the type attribute from your script tags, too. Here’s what the new script tag looks like without the type attribute:

<script src="betik.js"></script>

or if you prefer to type inline code rather than an external .js file:

<script>
   var harikasin = true;
</script>
Be Sociable, Share!

Leave a Reply

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


*