Revisiting Some (Old) Tags in HTML5

by kirupa   |   6 March 2011 (updated on 12 September 2012)

  Have questions? Discuss this HTML5 tutorial with others on the forums.

There are many changes HTML 5 brings to the table that earlier incarnations of HTML, CSS, and even JS may not have provided. While everyone tends to focus only on the changes that have been added, there have been some changes made to things such as tags that you use frequently.

In this short article, let's look at the changes that your existing HTML tags may need to undergo on the path to HTML 5 greatness.

Doctype Declaration

At the very top of your page, you will have a doctype declaration that lets your browser know how to read your page. Pre-HTML 5, you may have used a doctype declaration that looked as follows:

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

There were several variations depending on which HTML or XHTML version you were targeting. In HTML 5, the declaration has been simplified to the following:

<!DOCTYPE html>

There are no weird modifiers or anything beyond the word html.

The Charset Meta Tag

The charset meta tag is no longer what it used to be. It used to be more elaborate:

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">

Given that only two people in the world knew what the content and http-equiv tags even did, in HTML5, it has been shortened down to:

<meta charset="utf-8">

The most common charset value is utf-8, and you can read more about it in the UTF-8 Wikipedia article.

Style Tag

In the past, your style tag may have looked as follows:

<style type="text/css"> 
.fontModifier { 
	font-family: Arial, Helvetica, sans-serif; 
	font-size: large;
} 
</style>

In HTML 5, you can ignore the type attribute and its value and just go with only style:

<style> 
.fontModifier { 
	font-family: Arial, Helvetica, sans-serif; 
	font-size: large;
} 
</style>

This simplification makes sense, for when was the last time anything under than CSS (which is text based) was used for styling a page?

Script Tags

You used to be able to specify the language in your script declarations:

<script language="JavaScript"> 
	launchNewWindow(); 
</script>

 In HTML5, your script tag is literally just a script tag:

<script> 
	launchNewWindow(); 
</script>

This applies to any external script files you may be interested in referencing as well:

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

If you have been dying to use vbscript in your pages, you are going to be out of luck. Sigh.

Conclusion

That's all there is to this list for now. While the number of changes to the HTML 5 specification have slowed down, there may be some changes down the road where this list may grow or shrink depending on the nature of those changes.

Getting Help

If you have questions, need some assistance on this topic, or just want to chat - post in the comments below or drop by our friendly forums (where you have a lot more formatting options) and post your question. There are a lot of knowledgeable and witty people who would be happy to help you out

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends:

If you didn't like it, I always like to hear how I can do better next time. Please feel free to contact me directly via e-mail, facebook, or twitter.

Brought to you by...

Kirupa Chinnathambi
I like to talk a lot - A WHOLE LOT. When I'm not talking, I've been known to write the occasional English word. You can learn more about me by going here.

Add Your Comment (or post on the Forums)

blog comments powered by Disqus

Awesome and high-performance web hosting!
BACK TO TOP
new books - yay!!!