Sei sulla pagina 1di 13

HTML 5

Chapter 4-2
Endra Rahmawati, M.Kom
What is HTML 5 ?
HTML5 is the latest standard for HTML.
The previous version of HTML, HTML 4.01, came in
1999, and the internet has changed significantly since
then.
It was specially designed to deliver rich content
without the need for additional plugins. The current
version delivers everything from animation to graphics,
music to movies, and can also be used to build
complicated web applications.
HTML5 is also cross-platform. It is designed to work
whether you are using a PC, or a Tablet, a Smartphone,
or a Smart TV.
HTML5 - New Features
The <canvas> element for 2D drawing
The <video> and <audio> elements for media
playback
Support for local storage
New content-specific elements, like <article>,
<footer>, <header>, <nav>, <section>
New form controls, like calendar, date, time,
email, url, search
A Simple HTML5 Document
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
Content of the document......
</body>
</html>
A Simple HTML5 Document
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
New Media Elements
HTML5 <audio> Tag
<!DOCTYPE html>
<html>
<body>
<audio controls>
<source src=vierra.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</body>
</html>
HTML 5 <video> Tag
<!DOCTYPE HTML>
<html>
<body>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
HTML <source> type Attribute
<!DOCTYPE HTML>
<html>
<body>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
HTML <source> media Attribute
<!DOCTYPE html>
<html>
<body>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4" media="screen and (min-
width:320px)">
Your browser does not support the video tag.
</video>
<p><b>Note:</b> The media attribute is currently not supported in any of
the major browsers.</p>
</body>
</html>
HTML <embed> Tag
<!DOCTYPE html>
<html>
<body>
<embed src="helloworld.swf">
</body>
</html>
HTML5 <canvas> Tag
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="200" height="200" style="border:1px solid">
Your browser does not support the HTML5 canvas
</canvas>
<script>
var c=document.getElementById('myCanvas');
var ctx=c.getContext('2d');
ctx.fillStyle='#FF0000';
ctx.fillRect(0,0,80,100);
</script>
</body>
</html>
Removed Elements
<acronym>
<applet>
<basefont>
<big>
<center>
<dir>
<font>
<frame>
<frameset>
<noframes>
<strike>
<tt>

Potrebbero piacerti anche