HTML5 Snippets
Found a nice little feature introduced by HTML5 in the article below:
Just to show that HTML5 isn't only about structure and saving keystrokes here and there, here's a nice example of an attribute feature that is simple on the surface, but demonstrates some real power. Paste this simple little document into a text file, and call it something like foo.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>You Can Edit This</title>
</head>
<body>
<h1>I Mean, You Can Really Edit This</h1>
<p contenteditable=true> Here's where the contenteditable=true HTML5 tag does it's work...</p>
</body>
</html>
The only new thing here that will jump out at you is the attribute of contenteditable on the paragraph tag. You can use this on any element, not just a paragraph, and it takes effect for everything within that element. Now, open this file using any modern browser, and you'll see that you can indeed edit the paragraph - but not the heading! - right in the browser and then save it.