Defining content
<body>
<header>
<hgroup>
<h1>Page title</h1>
<h2>Page subtitle</h2>
</hgroup>
</header>
<nav>
<ul>
Navigation...
</ul>
</nav>
<section>
<article>
<header>
<h1>Title</h1>
</header>
<section>
Content...
<link rel="alternate" type="application/rss+xml" href="http://myblog.com/feed" /> <link rel="icon" href="/favicon.png" /> <link rel="pingback" href="http://myblog.com/xmlrpc.php"> <link rel="prefetch" href="http://myblog.com/main.php"> ... <a rel="archives" href="http://myblog.com/archives">old posts</a> <a rel="external" href="http://notmysite.com">tutorial</a> <a rel="license" href="http://www.apache.org/licenses/LICENSE-2.0">license</a> <a rel="nofollow" href="http://notmysite.com/sample">wannabe</a> <a rel="tag" href="http://myblog.com/category/games">games posts</a> ...
<div itemscope itemtype="http://example.org/band">
<p>My name is <span itemprop="name">Neil</span>.</p>
<p>My band is called <span itemprop="band">Four Parts Water</span>.</p>
<p>I am <span itemprop="nationality">British</span>.</p>
</div>
<ul id="tree1"
role="tree"
tabindex="0"
aria-labelledby="label_1">
<li role="treeitem" tabindex="-1" aria-expanded="true">Fruits</li>
<li role="group">
<ul>
<li role="treeitem" tabindex="-1">Oranges</li>
<li role="treeitem" tabindex="-1">Pineapples</li>
...
</ul>
</li>
</ul>
Low level control over rendering
var canvas = document.getElementById("canvas2d");
var context = canvas.getContext("2d");
context.moveTo(x1, y1); context.lineTo(x2, y2);
context.arc(x, y, r, Math.PI * 1/2, Math.PI * 3/2, false);
var id = context.getImageData(0, 0, width, height).data; var r = id[0], g = id[1], b = id[2], a = id[3] / 255;
context.lineWidth = 20; context.lineCap = "round"; context.strokeStyle = "rgba(255, 0, 0, 0.7)"; context.stroke();
<canvas id="canvas"></canvas>
<script>
var gl = document.getElementById("canvas").getContext("experimental-webgl");
gl.viewport(0, 0, canvas.width, canvas.height);
</script>
<svg height="300" width="800">
<defs>
<path id="textPath" d="
M 50,100 C 200,0 200,300 400,200 C 600,0 600,300 800,100">
</defs>
<text>
<tspan><textPath xlink:href="#textPath">Did you know that
SVG can render text along a path?</textPath></tspan>
</text>
</svg>
A richer experience with sound and video
<audio src="sound.ogg" controls></audio>
<script>
document.getElementById("audio").muted=false;
</script>
<video src='movie.webm' autoplay controls ></video>
<script>
document.getElementById("video").play();
</script>
Interacting with the client Operating System
var elem = document.getElementById('dragElem');
elem.addEventListener('dragstart', ..., false);
elem.addEventListener('dragend', ..., false);
var target = document.getElementById('dragTarget');
target.addEventListener('dragenter', ..., false);
target.addEventListener('dragleave', ..., false);
target.addEventListener('dragover', ..., false);
target.addEventListener('drop', ..., false);
var reader = new FileReader();
reader.onload = function(evt) {
document.querySelector('img').src = evt.target.result;
};
function onDrop(evt) {
reader.readAsDataURL(evt.dataTransfer.files[0]);
};
if (window.webkitNotifications.checkPermission() == 0) {
window.webkitNotifications.createNotification(picture, title, text).show();
} else {
window.webkitNotifications.requestPermission();
}
This presentation currently does not have permission to display notifications.
window.addEventListener("deviceorientation", function(event) {
var a = event.alpha;
var b = event.beta;
var g = event.gamma;
}
Making things look good
color: hsl(215,50%,50%); H: S: L: background-color: hsl(50,50%,100%); H: S: L: -webkit-box-reflect: below 10px -webkit-gradient( linear, left top, left bottom, from(transparent), to(rgba(255, 255, 255, 0))); Reflection: text-shadow: rgba(0, 0, 0, 0.9) 0 0px 0px; Text Shadow: -webkit-box-shadow: rgba(0, 0, 0, 0.9) 0 0px 0px; Box Shadow: -webkit-text-stroke: 0px #000; Radius: border-radius: 0px; Radius:
-webkit-transform: rotate(-10deg) scale(1.5);
| rotate(-45deg) | rotate(-15deg) | rotate(15deg) | rotate(45deg) | rotate(75deg) |
|---|---|---|---|---|
|
|
|
|
|
| scale(0.2) | scale(0.5) | scaleX(0.5) | scaleX(2.0) | scaleY(1.5) |
|
|
|
|
|
| skewX(10deg) | skewX(20deg) | skewX(30deg) | skewX(40deg) | skewX(50deg) |
|
|
|
|
|
.myDiv { -webkit-transition: -webkit-transform 2s ease-in-out; }
.myDiv:hover { -webkit-transform: rotate(-20deg); }
@-webkit-keyframes pulse {
0% { -webkit-transform: scale(2) rotate(5deg); }
50% { -webkit-transform: scale(5) rotate(-15deg); }
100% { -webkit-transform: scale(2) rotate(5deg); }
}
div {
-webkit-animation-name: pulse;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-direction: alternate;
}
*Please make a better use of it. We don't want a new <blink> tag ;)
@font-face {
font-family: 'Molengo';
src: local('Molengo'), url('fonts/Molengo.otf') format('opentype');
}
div { font-family: 'Molengo'; }
HTML5 Random Ransom Note!