Showing posts with label HTML5. Show all posts
Showing posts with label HTML5. Show all posts

Wednesday, July 3, 2013

Some new structural tags in HTML5

Before HTML5, <div> elements were the only opportunity for defining block-level page structure. HTML5 introduced us with few important structural elements: header, footer, nav, article, section, aside and hgroup.  The new elements simply give us an element that carries more meaning, with which to replace the generic <div>.

structural tags in html5

Header: Header element is designed for the header area of a page or page section. The header element can contain h1-h6 heading tag and other elements as well. it can be nested within each <article> element of a single web page.
<header>
    <h1>Anupam Dutta</h1>
    <h2>(Web and Desktop Application Developer)</h2>
</header>
Footer: The footer tag of HTML5 usually contains information of a section or document. Basically author information, copyright data, links to related documents, social networking and sharing links are placed within the footer tag.
<footer>
  <h3> Copyright 2013 Anupam Dutta</h3>
</footer>
Nav: Nav element contains the navigation functionality of a page such as table of contents and menu. Nav can appear more than once in a web page.
<nav>
    <ul>
      <li><a href="#HOME">HOME</a></li>
      <li><a href="#MVC">MVC</a></li>  
      <li><a href="#MSSQL">MSSQL</a></li>  
      <li><a href="#HTML5">HTML5</a></li>  
      <li><a href="#ABOUT">ABOUT</a></li>  
    </ul>
</nav>
Section: The section element is similar to <div> as a general container which represents a standard section of a document, web page or application, such as a chapter, for example.  It has some semantic meaning. Section is a sectional element but <div> is not a sectional element. Section indicates a new section in a document.
<section id="MSSQL">
  <h2> MSSQL DATABASE BACKUP</h2>
  <!-- multiple article elements could go in here -->
</section>
<section id="MVC">
  <h2> ASP.NET MVC SCAFFOLDING IN CODE FIRST SCENARIOS </h2>
  <!-- multiple article elements could go in here -->
</section>
Article: The article element represents an independent section of a document, page or site. It is appropriate for content like a magazine or newspaper article, blog articles, individual comments or forum posts, an interactive gadget or widget.
<article>
  <section id="MVC">
    <h2>ASP.NET MVC SCAFFOLDING IN CODE FIRST SCENARIOS</h2>
  </section>
  <section id="MSSQL">
    <h2>MSSQL DATABASE BACKUP</h2>
  </section>
</article>
Aside: The aside element is for content that is tangentially related to another content item (such as a section or article), and is typically useful for marking up sidebars.
<aside>
  <table>
<h2>Related post</h2>
    <!-- lots of quick facts inside here -->
  </table>
</aside>
Hgroup: The hgroup element is used to group any set of h1 - h6 elements when the heading has multiple levels.
<header>
  <hgroup>
    <h1>Anupam Dutta</h1>
    <h2>(Web and Desktop Application Developer)</h2>
  </hgroup>
</header>

Read More

Thursday, June 27, 2013

Audio and Video in HTML5

<audio> and <video> tags of HTML5 allows us to incorporate native audio and video support without Flash.

To include audio and video we need to set src attribute to identify the media source and include a controls attribute so the user can play and pause the media.

The simplest way of embedding a video file in a webpage:

<video src="video.mp4" width="320" height="200" controls preload></video>

<audio src="audio.mp3" controls preload></audio>

We can use <source> tag to indicate media along with media type and many other attributes. A video/Audio element allows various source elements and browser will use the first recognized format:

<video width="618" height="347" controls preload> 
    <source src="video.mp4" media="only screen and (min-device-width: 568px)"></source>
    <source src="video.iphone.mp4" media="only screen and (max-device-width: 568px)"></source>
</video>

<audio controls preload> 
    <source src="audio.mp3"></source> 
    <source src="audio.ogg"></source> 
</audio>

Attribute Specification:
Autoplay: The video/audio will automatically begin to play back as soon as it can do so without stopping to finish loading the data.
Autobuffer: The video/audio will automatically begin buffering even if it's not set to automatically play.
Controls: It will allow the user to control video/audio playback, including volume, seeking, and pause/resume playback.
Loop: It will allow video/audio automatically seek back to the start after reaching at the end.
Preload: This attribute specifies that the video/audio will be loaded at page load, and ready to run. Ignored if autoplay is present.
Src: The URL of the video/audio to embed.
Height: Height of the video's display area in pixels.
Width: Width of the video's display area in pixels.
Poster: URL of an image which will be displayed while the video is loading.


Read More