There are lots of new features in HTML5, but some elements from HTML4 have been changed or removed. So here are a few tips for changes you might need to make if you’re upgrading.
1. The CENTER tag
The center tag was deprecated in HTML4/XHTML, and not allowed in XHTML Strict. It should be avoided on the grounds that it is used to style content. CSS should be used instead. But if you were holding on to your center tag and you plan to use HTML5, it’s time to let go. It’s not part of the HTML5 specification, so start using CSS.
2. The A tag
The a tag has undergone a few changes. In HTML4, it could represent a hyperlink or an anchor. Now it’s always a hyperlink. If there’s no href attribute, it’s a hyperlink placeholder. New are the media and type attributes. The media attribute indicates the type of device the URL is optimized for, much like the media attribute on style tags or link tags. The type attribute specifies the MIME type of the URL. Finally, if you’ve been using XHTML Strict, you’ll be happy to know you can start using the target attribute again.
This one may be a little obvious, but I think it’s pretty cool. HTML4 and XHTML were based on SGML, and needed a DTD reference, via the !DOCTYPE declaration. HTML5 is not, and it doesn’t. The !DOCTYPE is still used to identify the document as HTML5, but it’s much simpler: That’s it. And it’s not case-sensitive. I think that’s quite a bit easier to remember than the old way.
4. The EMBED tag
Technically, the embed tag is new to HTML5. It wasn’t part of the HTML4 specification. However, it is widely used to embed flash content (for example) in a way that Internet Explorer can recognize. There are perfectly web-standard ways to allow IE users to view your Flash content, so I recommend using those (whether you’re using HTML4, XHTML, or HTML5.) Neither the embed nor object tags support the classid attribute anymore though, so you might be best off using something like SWFObject to embed Flash in a widely compatible way.
5. Frames vs. iframes
All frames and frame-related tags, other than inline frames (iframe,) have been removed for the HTML5 specification. So if you were using a frameset, you’ll have to change to a single document or switch to iframes if you want to be compatible with HTML5.