HTML5 (i) Learning HTML5 new features

Source: Internet
Author: User

I. What are the new features of HTML5

1. <audio>, <video> for media playback

2. <canvas> for painting

3. Better support for local offline storage

4. New special content elements, such as: article, header, footer, NAV, etc.

5. New form controls, such as Calendar, date, time, email, url, search


Second, audio and video playback

1. Simple audio playback and video playback

<video width= "100%" height= "80%" src= "/media/coolshow_02.mp4" controls= "Controls" > your browser does not support this tab </video>    <audio src= "./media/my_destiny.mp3" controls= "Controls" > your browser does not support this element </audio>
The controls property above uses <video> and <audio> 's own playback controls, such as play control, sound control, full-screen control, and so on.


2. Formatting issues

How do I use the same code on different browsers because of different playback formats supported by different browsers?

HTML5 provides <resource> tags that can provide multiple sets of video formats, and the browser automatically uses the first recognizable video format.

  <video width= "height=" controls= "Controls" >             <source src= "Movie.ogg" type= "Video/ogg" >             <source src= "Movie.mp4" type= "Video/mp4" >                             your browser does not support this tab        </video>
3. Custom button for Play/pause, screen size control.

<script type= "Text/javascript" >    var myvideo = document.getElementById ("Video1");    function Playpause () {        if (myvideo.paused)            myvideo.play ();        else            myvideo.pause ();    }    function Makebig () {        myvideo.width = 560;    }    function Makesmall () {        myvideo.width =;    }    function Makenormal () {        myvideo.width = 420;    } </script>
4. Video Codec tool

1) Codec toolFFmpeg
Official website: www.ffmpeg.orgDownload:http://ffmpeg.zeranoe.com/builds/2) transcoding using the command linedirective,Enter the path to the file that needs transcoding CD d:\a Then, execute the transcoding directive d:\a> D:\ffmpeg\bin\ffmpeg-I.A.mp3-acodec LibvorbisB.mp4
    D:\ffmpeg\bin\ffmpeg: Path to the transcoding tool for the download

Three, drag

<! DOCTYPE html>


Four, canvas painting

The canvas element itself is not capable of drawing, and all the drawing work must be done in JS.
1. Draw lines

<! DOCTYPE html>

2. Draw a circle, fill

<! DOCTYPE html>

3. Draw the gradient and fill with the gradient color

<! DOCTYPE html>


V. SVG

Similar to canvas, the difference is that SVG-drawn graphs are scalable vectors that are not dependent on resolution.

1. Draw the Pentagram

<! DOCTYPE html>


Vi. geographical location of geolocation









HTML5 (i) Learning HTML5 new features

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.