Tuesday, 10 September 2013

Understanding the New Way to Present Content on the Web- Using “Article” Markup Element in your HTML Pages


As discussed in an earlier article on Javaguerrier, HTML5 introduced a lot of new markup elements to enable rich web authoring.

The “article” markup element is one of the new sectioning elements introduced in HTML5.
The HTML5 specification defines “article” markup element as a self-contained composition in a document, page that is independently reusable in syndication.
It can be used for a newspaper article, a blog entry or a forum post, or any independent item of content.

Few notes facts about “article” markup element

  •       Article markup element can be used where flow content is expected.
  •      The “article” markup elements are global attributes.
  •      The “article” element uses “HTMLElement”.
  •      An “article” markup element can have headers
  •       An “article” markup element can have footers.
  •        "Article” markup elements can be nested.
  •       When “article” elements are nested, the nested elements should be principally related to the parent      article. A classic example would be comments on a blog post are related to the blog post.
  •       “Article” markup elements can work with “section” markup elements. However, note that “article” is used when the content is self-contained. HTML5 specification does not dictate that “section” element should have the content which is self-contained.


Using “article” markup element
Simply put, a simple HTML5 webpage using article markup element looks as under.


<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>Article sample</title>
<body>
    <article>
        <header>
            <h1>Article sample</h1>
            <p>The First sample using Article markup element</p>
        </header>
        <footer>
            <h1></h1>
            <p>HTML Goodies</p>
        </footer>
    </article>
</body>
</html>

This will result in a display on the web page as under:



Nested “article” markup elements need to put under a section element.
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>Article sample 2</title>
<body>
    <article>
        <header>
            <h1>Article sample using nested articles</h1>
            <p>The Second sample using Article markup element</p>
        </header>
        <footer>
            <h1></h1>
            <p>HTML Goodies</p>
        </footer>
        <section>
            <h1>Comments</h1>
            <article id="comment1">
                <footer>
                    <p>Posted by: Commenter 1</p>
                    <p><time datetime="2013-07-26">1 day ago</time></p>
                </footer>
                <p>This is a a very trivial example</p>
            </article>
            <article id="comment2">
                <footer>
                    <p>Posted by: Commentor 2</p>
                    <p><time datetime="2013-07-27">1 minute ago</time></p>
                </footer>
                <p>Nah, this looks like an advanced concept.</p>
            </article>
        </section>
    </article>
</body>
</html>

The webpage above will look as under:





Monday, 9 September 2013

A 5 Minute Overview of All New HTML5 Markup Elements

Introduction 

With the announcement of the recommended specification of HTML5, we are even closer than ever to the announcement of the final specification of HTML5 (which can happen at any moment). HTML5 introduces a bunch of new markup elements as well as support for programmatic APIs which can be used with JavaScript to build web pages which can act as web applications.
         
    In this article, we will do a quick rundown of all the new markup elements new in HTML5.

  • Article - The article element is a new sectional element and is used to represent a self-contained entry in a document, page, application or site. 
  • Aside - The aside element is used to represent content which is tangentially related to the content which is around aside element, sometimes, represented as sidebars. 
  • audio - The audio element is a type of media element used to represent an audio stream. 
  • canvas - The canvas element is used for rendering graphs, game graphics, art images or other visual images using a resolution dependent bitmap canvas. 
  • command - The command element represents a command which can be invoked by a user. It can be part of a menu element (explicitly part of a context menu or toolbar); alternately it can be placed anywhere else on the page to define a keyboard shortcut or to define other commands. 
  • datalist - The datalist element is used to represent a set of option elements which can act as options of other controls. datalist elements are wired to input elements using the list attribute on the input element. 
  • details - The details element is used to represent an area where users can go to obtain additional information. The details element in an interactive element represented as a widget. 
  • embed - The embed element is used to represent an integration point for a non-HTML application or interactive content. 
  • summary - The summary element is an interactive element used to represent a summary or legend for the rest of the content. 
  • Figure - The figure element is a grouping element is used to group content that is self-contained and is typically referenced as a single unit from the main flow of the document. 
  • Figcaption - The figcaption element represents the caption for a figure element. 
  • Footer - The footer element is used to represent a footer of the preceding sectional content. 
  • Header - The header element is used to represent a header for the succeeding sectional content. 
  • keygen - The keygen element is used to represent a key pair generator control which is used to store the private key in the local keystore and send the public key to the server when the form is submitted. The keygen element is a form element. 
  • mark - The mark element is used to highlight a range of text in a document for reference purpose. It is equivalent of using a highlighter to highlight a bunch of text. 
  • meter - The meter element is used to represent a scalar measurement within a known range, for example, how many respondents were male with kids. It should not be used to indicate progress. 
  • nav - The nav element is a section with navigation links and represents a section of page that links to other pages. 
  • output - The output element is used to represent the result of a calculation or user action. It supports representation of explicit relationship between itself and the elements that represent the values that went into the calculation of the output value. 
  • progress - The progress element is used to represent the progress of a task. It supports both indeterminate situations as well as determinate situations. 
  • Ruby - The ruby element is used to support one or more spans of content to be marked with ruby annotations. 
  • rt - The rt element is used to mark the ruby text component for a ruby annotation. 
  • rp - The rp element is used to provide parenthesis around a ruby text component of a ruby annotation. 
  • Section - The section element is used to represent a generic section of a document or application, usually containing a heading. E.g. chapters in a book. 
  • Source - The source element is used to specify to alternate media resources for media elements. It is not supposed to be dynamically modified, as that will have no effect. 
  • Summary- The summary element is an interactive element which is used to represent a summary, or caption for a details element. 
  • Time - The time element represents datetime attribute contents in a machine readable form (limited to various kinds of dates, times, time-zone offsets, and durations). 
  • Video - The video element is a type of media element used to represent a video stream. 
  • wbr - The wbr element is used to represent a line break in a web page. 
Summary 
In this article, we learned about all the new markup elements in HTML5. I hope you have found this information useful. In upcoming articles, we will review these new markup elements in more detail.

What is HTML5?

Introduction
It won’t be incorrect to say that the World Wide Web was invented as a consequence of Tim-Berners Lee drafting a memo that defined a markup language called HyperText MarkupLanguage (HTML) to create documents and reference each other in a consistent manner to enable access via Internet. 

The markup language was quite simple when it was originally drafted in 1991 where it had only 18 HTML tags. As web programming evolved, it was necessary to ramp up the specification. HTML4 specification was announced in December 1997 and later revised in April 1998 and December 1999. 

The changing landscape for web programming resulted in yet another revision of the HTML spec, which was announced as a draft specification in January 2008. HTML5 garnered world attention when the Apple CEO at that time, late Steve Jobs, suggested the future of web hinged on HTML5 and did not see Flash as needed to view web content. This statement brought renewed focus on HTML5 and in December 2012, the HTML5 specification was considered W3C (World Wide Web Consortium) recommendation. Adobe later announced it was discontinuing Flash, leaving HTML5 alone on the race to support media-rich Internet. 

One of the areas that has not been adequately addressed by prior HTML specifications were “Web Applications”. The HTML5 specification addresses these shortcomings; moreover, it also addresses concerns which have been raised against the past version of the HTML specifications over the years. 

What is a layman’s definition of HTML5? 
HTML5 can be viewed as a specification with support for new markups as well as support for programmatic APIs (JavaScript) to support web application scenarios. The HTML5 specification intends to provide first class support for multimedia interaction as well as introduce programmatic capabilities into the specification allowing a web page to act as an application. HTML5 was conceived after observing that there were a lot of mixed features in the HTML and XHTML specifications, and it was an attempt to define a single markup language which could be written in either HTML or XHTML syntax. 

How does the HTML5 landscape look today? 
Today, majority of the browsers have declared HTML5 compatibility as their goals. Browser vendors have rushed to build support for HTML5 into their browsers even though the specification has not been formalized. At the time of writing this article, Google’s Chrome led the pack amongst the popular browser in terms of HTML5 support. Note that Maxthon browser had the most HTML5 compatibility, but it is not have significant market share globally. Google Chrome (version 28) scores 463 points on HTML5test.com website out of a possible 500. Opera (version 15) and Firefox (version 22) are close behind with scores of 423 and 410 respectively. Internet Explorer (version 10) is at the bottom of the list of popular browsers with a score of 320. While none of the browsers are fully compliant to the HTML specification, the race to reach full HTML5 compatibility between the browser vendors is on, and only time will tell who will win.

Summary 
In this article, we learned about HTML5 and its history. In upcoming articles in this series, we will explore how to build HTML5 web pages using the new markups as well as the support for JavaScript APIs. I hope you have found this information useful.