Tuesday, 24 April 2012

New Tags in HTML 5.0 -Part 2


Canvas:

The <canvas> tag is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari.

Note: Internet Explorer 8 and earlier versions, do not support the <canvas> tag.
The <canvas> tag is used to draw graphics, on the fly, via scripting (usually JavaScript).
The <canvas> tag is only a container for graphics, you must use a script to actually draw the graphics.

<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas">Your browser does not support the canvas tag.</canvas>
<script type="text/javascript">
var canvas=document.getElementById('myCanvas');
var ctx=canvas.getContext('2d');
ctx.fillStyle='#FF0000';
ctx.fillRect(0,0,80,100);
</script>
</body>
</html>



Result:





Datalist:
The <datalist> tag is currently only supported in Firefox and Opera.
The <datalist> tag specifies a list of pre-defined options for an <input> element.
The <datalist> tag is used to provide an "autocomplete" feature on <input> elements. Users will see a drop-down list of pre-defined options as they input data.
Use the <input> element's list attribute to bind it together with a <datalist> element.
<html>
<body>
<form action="demo_form.asp" method="get">
<input list="browsers" name="browser" />
<datalist id="browsers">
  <option value="Internet Explorer">
  <option value="Firefox">
  <option value="Chrome">
  <option value="Opera">
  <option value="Safari">
</datalist>
<input type="submit" />
</form>
</body>
</html>

Result:












Details:

The <details> tag is currently only supported in Chrome.
The <details> tag specifies additional details that the user can view or hide on demand.
The <details> tag can used to create an interactive widget that the user can open and close. Inside <details>, there can be put any sort of content.
The content of a <details> element should not be visible unless the open attribute is set.

<!DOCTYPE html>
<html>
<body>
<details open="open">
<summary>Copyright 1999-2011.</summary>
<p> - by Refsnes Data. All Rights Reserved.</p>
<p>All content and graphics on this web site are the property of the company Refsnes Data.</p>
</details>
</body>
</html>


figure and Figcaption:
The <figcaption> and <figure> tag is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari.
Note: Internet Explorer 8 and earlier versions, do not support the <figcaption>  and <figure> tag.
The <figure> tag specifies self-contained content, like illustrations, diagrams, photos, code listings, etc.
While the content of the <figure> element is related to the main flow, its position is independent of the main flow, and if removed it should not affect the flow of the document.
The <figcaption> tag defines a caption for a <figure> element.
The <figcaption> element can be placed as the first or last child of the <figure> element.
Example:
Use a <figure> element to mark up a photo in a document. The <figure> element also contains a caption:
<!DOCTYPE html>
<html>
<body>
<figure>
  <img src="http://www.picgifs.com/graphics/g/google/graphics-google-018918.jpg" alt="The Pulpit Rock" width="304" height="228" />
  <figcaption>Fig.1 - Google Pc.</figcaption>
</figure>
</body>
</html>




Footer:
The <footer> tag is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari.
Note: Internet Explorer 8 and earlier versions, do not support the <footer> tag.
The <footer> tag defines a footer for a document or section.
A <footer> element should contain information about it’s containing element.
A footer typically contains the author of the document, copyright information, links to terms of use, contact information, etc.
You can have several <footer> elements in one document.
Example:
A footer section in a document:
<html>
<body>
<footer>
  <p>Posted by: Hege Refsnes</p>
  <p><time pubdate datetime="2012-03-01"></time></p>
</footer>
</body>
</html>


Header:

The <header> tag is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari.

Note: Internet Explorer 8 and earlier versions, do not support the <header> tag.

The <header> tag specifies a header for a document or section.
The <header> element should be used as a container for introductory content or set of navigational links.
You can have several <header> elements in one document.  

Note: A <header> tag cannot be placed within a <footer>, <address> or another <header> element.

Example:
A header for an <article>:
<html>
<body>
<article>
  <header>
    <h1>Internet Explorer 9</h1>
    <p><time pubdate datetime="2011-03-15"></time></p>
  </header>
  <p>Windows Internet Explorer 9 (abbreviated as IE9) was released to
  the  public on March 14, 2011 at 21:00 PDT.....</p>
</article>
</body>
</html>








Thursday, 19 April 2012

New Tags in HTML 5.0-Part1


Article:

The <article> tag is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari.

Note: Internet Explorer 8 and earlier versions, do not support the <article> tag.

The <article> tag specifies independent, self-contained content.

An article should make sense on its own and it should be possible to distribute it independently from the rest of the site.

Potential sources for the <article> element:
  • Forum post
  • Blog post
  • News story
  • Comment
<html>
<body>
<article>
  <h1>Internet Explorer 9</h1>
  <p>Windows Internet Explorer 9 (abbreviated as IE9) was released to
  the  public on March 14, 2011 at 21:00 PDT.....</p>
</article>
</body>
</html>

Result:

aside:

The <aside> tag is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari.
 Note: Internet Explorer 8 and earlier versions, do not support the <aside> tag.

The <aside> tag defines some content aside from the content it is placed in.

The aside content should be related to the surrounding content.

<!DOCTYPE html>
<html>
<body>
<aside style="font-size:larger;font-style:italic;color:green;float:right;width:120px;">
70% of the world's reefs will be destroyed over the next 40 years.
</aside>
<p>Global warming is affecting coral reefs all over the world. At the current rate, 70% of the world's reefs will be destroyed over the next 40 years.</p>
</body>
</html>
 

Result:
Audio:

The <audio> tag is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari.

Note: Internet Explorer 8 and earlier versions, do not support the <audio> tag.

The <audio> tag defines sound, such as music or other audio streams.

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

Result:




Bdi:

The <bdi> tag is currently supported only in Firefox and Chrome.

bdi stands for Bi-directional Isolation.

The <bdi> tag isolates a part of text that might be formatted in a different direction from other text outside it.

This element is useful when embedding user-generated content with an unknown directionality.

<!DOCTYPE html>
<html>
<body>
<ul>
 <li>User <bdi>hrefs</bdi>: 60 points</li>
 <li>User <bdi>jdoe</bdi>: 80 points</li>
 <li>User <bdi>إيان</bdi>: 90 points</li>
</ul>
</body>
</html>

Result:


Some Special tags present in HTML 4.0.1 -Part2

Dd:

The <dd> tag is supported in all major browsers.

The <dd> tag is used to describe an item in a definition list.

The <dd> tag is used in conjunction with <dl> (defines the definition list) and <dt> (defines the item in the list).

Inside a <dd> tag you can put paragraphs, line breaks, images, links, lists, etc.
<html>
<body>
<dl>
  <dt>Coffee</dt>
  <dd>- black hot drink</dd>
  <dt>Milk</dt>
  <dd>- white cold drink</dd>
</dl>
</body>
</html>

Result:
Del:

The <del> tag is supported in all major browsers.

The <del> tag defines text that has been deleted from a document.

Tip: Also look at the <ins> tag to markup inserted text.

Browsers will normally strike a line through deleted text and underline inserted text.

<html>
<body>
<p>My favorite color is <del>blue</del> <ins>red</ins>!</p>
<p>Notice that browsers will strikethrough deleted text and underline inserted text.</p>
</body>
</html>

Result:



Fieldset:

The < fieldset > tag is supported in all major browsers.

The <fieldset> tag is used to group related elements in a form.

The <fieldset> tag draws a box around the related elements.

Tip: The <legend> tag defines a caption for the <fieldset> element.

<html>
<body>
<form>
<fieldset>
<legend>Personalia:</legend>
Name: <input type="text" /><br />
Email: <input type="text" /><br />
Date of birth: <input type="text" />
</fieldset>
</form>
</body>
</html>

Result:



q:

The <q> tag is supported in all major browsers.

The <q> tag defines a short quotation.

Browsers often insert quotation marks around the quotation.
<html>
<body>
<p>WWF's goal is to:
<q>build a future where people live in harmony with nature</q>.
</body>
</html>

Result:
WWF's goal is to: build a future where people live in harmony with nature.

sub and sup:

The <sub> tag defines subscript text. Subscript text appears half a character below the baseline. Subscript text can be used for chemical formulas, like H2O.
The <sup> tag defines superscript text. Superscript text appears half a character above the baseline. Superscript text can be used for footnotes, like WWW[1].

<html>
<body>
<p>This text contains <sub>subscript</sub> text.</p>
<p>This text contains <sup>superscript</sup> text.</p>
</body>
</html>

Result:
This text contains subscript text.
This text contains superscript text.

Some Special tags present in HTML 4.0.1 -Part1

Abbr:

The <abbr> tag is supported in all major browsers.

The <abbr> tag describes an abbreviated phrase.

By marking up abbreviations you can give useful information to browsers, spell checkers, translation systems and search-engine indexers

<html>
<body>
The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.
</body>
</html>

Result:


Acronym:

The <acronym> tag is supported in all major browsers

The <acronym> tag defines an acronym.

An acronym can be spoken as if it were a word, example NATO, NASA, ASAP, GUI.

By marking up acronyms you can give useful information to browsers, spell checkers, translation systems and search-engine indexers.

<html>
<body>
Can I get this <acronym title="as soon as possible">ASAP</acronym>?
</body>
</html>
Result:

Address:

The <address> tag is supported in all major browsers.

The <address> tag defines the contact information for the author or owner of a document. This way, the reader is able to contact the document's owner.

The <address> element is usually added to the header or footer of a webpage.

The content of the <address> element usually renders in italic. Most browsers will also add a line break before and after the <address> element.

<html>
<body>
<address>
Written by W3Schools.com<br />
<a href="mailto:us@example.org">Email us</a><br />
Address: Box 564, Disneyland<br />
Phone: +12 34 56 78
</address>
</body>
</html>

Result:


Base:

The <base> tag is supported in all major browsers.

The <base> tag specifies the base URL/target for all relative URLs in a document.

The <base> tag goes inside the <head> element.

<html>
<head>
<base href="http://www.w3schools.com/images/" target="_blank" />
</head>
<body>
<img src="stickman.gif" />
<a href="http://www.w3schools.com">W3Schools</a>(opens in new window)
</body>
</html>

Bdo:

The <bdo> tag is supported in all major browsers.

bdo stands for Bi-Directional Override.

The <bdo> tag is used to override the current text direction.

<html>
<body>
<bdo dir="rtl">Here is some Hebrew text that should be written from right-to-left!</bdo>
</body>
</html>

Result:

Col:

The <col> tag is supported in all major browsers.

The <col> tag defines attribute values for one or more columns in a table.

The <col> tag is useful for applying styles to entire columns, instead of repeating the styles for each cell, for each row.

The <col> tag can only be used inside a <table> or a <colgroup> element.

Set the background color of the three columns with the <colgroup> and <col> tags. Two <colgroup> elements. The first spans two columns and sets the background-color to red, the second sets the background-color to blue:

<html>
<body>
<table border="1">
  <colgroup>
    <col span="2" style="background-color:red" />
    <col style="background-color:yellow" />
  </colgroup>
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
  <tr>
    <td>5869207</td>
    <td>My first CSS</td>
    <td>$49</td>
  </tr>
</table>
</body>
</html>

Result: