Sunday, September 4, 2011

HTML 5 audio element

HTML 5 facilitates a standard way to play audio file. As of now following audio formats are supported.
  • ogg
  • mp3
  • wav
Format:
<audio> </audio>

Attributes:

src - url of the audio file to play
autoplay - starts the audio as soon as it is ready to play
controls - whether to show controls or not
loop - repeats the play when it finishes
preload - load the audio file with page load.

Example:

<audio controls="controls">
  <source src="song.ogg" type="audio/ogg" />
  <source src="song.mp3" type="audio/mpeg" />
Your browser does not support the audio element.
</audio>  


HTML 5 Video Element

HTML 5 facilitates a standard video element to show video in web page. As of now following video formates are supported.

  • Ogg = Ogg files with Theora video codec and Vorbis audio codec
  • MPEG4 = MPEG 4 files with H.264 video codec and AAC audio codec
  • WebM = WebM files with VP8 video codec and Vorbis audio codec
Element:

<video> </video>
Attributes:


  • src - url of the video
  • height - height of the player in pixels
  • width - width of the player in pixels
  • controls - if present player controls will be shown
  • autoplay - if present video will be started as soon as it is ready to play. Default is manual.
  • loop - if present video will be played from beginning when it finishes playing
  • poster - to show a placeholder image for player
  • preload - load the complete video at page load. This attribute is ignored if autoplay is present.
  • audio - to mute the audio

Example:

<video width="320" height="240" controls="controls" autoplay>
  <source src="movie.ogg" type="video/ogg" />
  <source src="movie.mp4" type="video/mp4" />
  <source src="movie.webm" type="video/webm" />
Your browser does not support the video tag.
</video> 









Monday, March 14, 2011

New Elements in HTML 5


New Elements in HTML5

The internet has changed a lot since HTML 4.01 became a standard in 1999.
Today, some elements in HTML 4.01 are obsolete, never used, or not used the way they were intended to. These elements are deleted or re-written in HTML5.
To better handle today's internet use, HTML5 also includes new elements for better structure, drawing, media content, and better form handling.

New Markup Elements

New elements for better structure:
TagDescription
<article>For external content, like text from a news-article, blog, forum, or any other content from an external source
<aside>For content aside from the content it is placed in. The aside content should be related to the surrounding content
<command>A button, or a radiobutton, or a checkbox
<details>For describing details about a document, or parts of a document
<summary>A caption, or summary, inside the details element
<figure>For grouping a section of stand-alone content, could be a video
<figcaption>The caption of the figure section
<footer>For a footer of a document or section, could include the name of the author, the date of the document, contact information, or copyright information
<header>For an introduction of a document or section, could include navigation
<hgroup>For a section of headings, using <h1> to <h6>, where the largest is the main heading of the section, and the others are sub-headings
<mark>For text that should be highlighted
<meter>For a measurement, used only if the maximum and minimum values are known
<nav>For a section of navigation
<progress>The state of a work in progress
<ruby>For ruby annotation (Chinese notes or characters)
<rt>For explanation of the ruby annotation
<rp>What to show browsers that do not support the ruby element
<section>For a section in a document. Such as chapters, headers, footers, or any other sections of the document
<time>For defining a time or a date, or both
<wbr>Word break. For defining a line-break opportunity.


New Media Elements

HTML5 provides a new standard for media content:
TagDescription
<audio>For multimedia content, sounds, music or other audio streams
<video>For video content, such as a movie clip or other video streams
<source>For media resources for media elements, defined inside video or audio elements
<embed>For embedded content, such as a plug-in


The Canvas Element

The canvas element uses JavaScript to make drawings on a web page.
TagDescription
<canvas>For making graphics with a script


New Form Elements

HTML5 offers more form elements, with more functionality:
TagDescription
<datalist>A list of options for input values
<keygen>Generate keys to authenticate users
<output>For different types of output, such as output written by a script

New Input Type Attribute Values

Also, the input element's type attribute has many new values, for better input control before sending it to the server:
TypeDescription
telThe input value is of type telephone number
searchThe input field is a search field
urlThe input value is a URL
emailThe input value is one or more email addresses
datetimeThe input value is a date and/or time
dateThe input value is a date
monthThe input value is a month
weekThe input value is a week
timeThe input value is of type time
datetime-localThe input value is a local date/time
numberThe input value is a number
rangeThe input value is a number in a given range
colorThe input value is a hexadecimal color, like #FF8800

Friday, March 11, 2011

HTML 5 Introduction


HTML5 is the next generation of HTML.

What is HTML5?

HTML5 will be the new standard for HTML, XHTML, and the HTML DOM.
The previous version of HTML came in 1999. The web has changed a lot since then.
HTML5 is still a work in progress. However, most modern browsers have some HTML5 support.

How Did HTML5 Get Started?

HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG).
WHATWG was working with web forms and applications, and W3C was working with XHTML 2.0. In 2006, they decided to cooperate and create a new version of HTML.
Some rules for HTML5 were established:
  • New features should be based on HTML, CSS, DOM, and JavaScript
  • Reduce the need for external plugins (like Flash)
  • Better error handling
  • More markup to replace scripting
  • HTML5 should be device independent
  • The development process should be visible to the public

New Features

Some of the most interesting new features in HTML5:
  • The canvas element for drawing
  • The video and audio elements for media playback
  • Better support for local offline storage
  • New content specific elements, like article, footer, header, nav, section
  • New form controls, like calendar, date, time, email, url, search

Browser Support

HTML5 is not yet an official standard, and no browsers have full HTML5 support.
But all major browsers (Safari, Chrome, Firefox, Opera, Internet Explorer) continue to add new HTML5 features to their latest versions.

 
  • Blogroll

  • Consectetuer

  • Popular

  • Comments