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

Saturday, 18 February 2017

HTML 5 Lesson 4 about Attributes


Attributes
 

As explained in previous chapter, elements may contain attributes that are used to set various properties of an element. 
Some attributes are defined globally and can be used on any element, while others are defined for specific elements only. All attributes have a name and a value and look like as shown below in the example. 
Following is the example of an HTML5 attributes which illustrates how to mark up a div element with an attribute named class using a value of "example" − 
<div class="example">...</div>

Attributes may only be specified within start tags and must never be used in end tags. 
HTML5 attributes are case insensitive and may be written in all uppercase or mixed case, although the most common convention is to stick with lowercase.
Standard Attributes
The attributes listed below are supported by almost all the HTML 5 tags.
Attribute

Options Function
accesskey User Defined Specifies a keyboard shortcut to access an element.
align right, left, center Horizontally aligns tags
background URL Places an background image behind an element
bgcolor numeric, hexidecimal, RGB values Places a background color behind an element
class User Defined Classifies an element for use with Cascading Style Sheets.
contenteditable true, false Specifies if the user can edit the element's content or not.
contextmenu Menu id Specifies the context menu for an element.
data-XXXX User Defined Custom attributes. Authors of a HTML document can define their own attributes. Must start with "data-".
draggable true,false, auto Specifies whether or not a user is allowed to drag an element.
height Numeric Value Specifies the height of tables, images, or table cells.
hidden hidden Specifies whether element should be visible or not.
id User Defined Names an element for use with Cascading Style Sheets.
item List of elements Used to group elements.
itemprop List of items Used to group items.
spellcheck true, false Specifies if the element must have it's spelling or grammar checked.
style CSS Style sheet Specifies an inline style for an element.
subject User define id Specifies the element's corresponding item.
tabindex Tab number Specifies the tab order of an element.
title User Defined "Pop-up" title for your elements.
valign top, middle, bottom Vertically aligns tags within an HTML element.
width Numeric Value Specifies the width of tables, images, or table cells.

Custom Attributes

A new feature being introduced in HTML 5 is the addition of custom data attributes.
A custom data attribute starts with data- and would be named based on your requirement. Following is the simple example −
<div class="example" data-subject="physics" data-level="complex">
   ...
</div>
The above will be perfectly valid HTML5 with two custom attributes called data-subject and data-level. You would be able to get the values of these attributes using JavaScript APIs or CSS in similar way as you get for standard attributes.

Tuesday, 14 February 2017

HTML 5 Lesson 3 syntax


Syntax
 

The HTML 5 language has a "custom" HTML syntax that is compatible with HTML 4 and XHTML1 documents published on the Web, but is not compatible with the more esoteric SGML features of HTML 4.

HTML 5 does not have the same syntax rules as XHTML where we needed lower case tag names, quoting our attributes,an attribute had to have a value and to close all empty elements.

But HTML5 is coming with lots of flexibility and would support the followings −
Uppercase tag names.
Quotes are optional for attributes.
Attribute values are optional.
Closing empty elements are optional.
The DOCTYPE

DOCTYPEs in older versions of HTML were longer because the HTML language was SGML based and therefore required a reference to a DTD.

HTML 5 authors would use simple syntax to specify DOCTYPE as follows −
<!DOCTYPE html>


All the above syntax is case-insensitive.
Character Encoding

HTML 5 authors can use simple syntax to specify Character Encoding as follows −
<meta charset="UTF-8">


All the above syntax is case-insensitive.
The <script> tag

It's common practice to add a type attribute with a value of "text/javascript" to script elements as follows −
<script type="text/javascript" src="scriptfile.js"></script>


HTML 5 removes extra information required and you can use simply following syntax −
<script src="scriptfile.js"></script>

The <link> tag

So far you were writing <link> as follows −
<link rel="stylesheet" type="text/css" href="stylefile.css">


HTML 5 removes extra information required and you can use simply following syntax −
<link rel="stylesheet" href="stylefile.css">

HTML5 Elements

HTML5 elements are marked up using start tags and end tags. Tags are delimited using angle brackets with the tag name in between.

The difference between start tags and end tags is that the latter includes a slash before the tag name.

Following is the example of an HTML5 element −
<p>...</p>


HTML5 tag names are case insensitive and may be written in all uppercase or mixed case, although the most common convention is to stick with lower case.

Most of the elements contain some content like <p>...</p> contains a paragraph. Some elements, however, are forbidden from containing any content at all and these are known as void elements. For example, br, hr, link and meta etc.

Here is a complete list of HTML5 Elements.
HTML5 Attributes

Elements may contain attributes that are used to set various properties of an element.

Some attributes are defined globally and can be used on any element, while others are defined for specific elements only. All attributes have a name and a value and look like as shown below in the example.

Following is the example of an HTML5 attributes which illustrates how to mark up a div element with an attribute named class using a value of "example" −
<div class="example">...</div>


Attributes may only be specified within start tags and must never be used in end tags.

HTML5 attributes are case insensitive and may be written in all upper case or mixed case, although the most common convention is to stick with lower case.

Here is a complete list of HTML5 Attributes.
HTML5 Document

The following tags have been introduced for better structure −


section − This tag represents a generic document or application section. It can be used together with h1-h6 to indicate the document structure.


article − This tag represents an independent piece of content of a document, such as a blog entry or newspaper article.


aside − This tag represents a piece of content that is only slightly related to the rest of the page.


header − This tag represents the header of a section.


footer − This tag represents a footer for a section and can contain information about the author, copyright information, etc.


nav − This tag represents a section of the document intended for navigation.


dialog − This tag can be used to mark up a conversation.


figure − This tag can be used to associate a caption together with some embedded content, such as a graphic or video.

The markup for an HTM 5 document would look like the following −
<!DOCTYPE html>
<html>

   <head>
      <meta charset="utf-8">
      <title>...</title>
   </head>
 
   <body>
      <header>...</header>
      <nav>...</nav>
  
      <article>
         <section>
            ...
         </section>
      </article>
  
      <aside>...</aside>
      <figure>...</figure> 
      <footer>...</footer>
      
   </body>
</html>
 Note:Wait for Next Post and Next Lesson.

Sunday, 12 February 2017

HTML 5 overview and Lesson 2



HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.
HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG).
The new standard incorporates features like video playback and drag-and-drop that have been previously dependent on third-party browser plug-ins such as Adobe Flash, Microsoft Silverlight, and Google Gears.
Browser SupportThe latest versions of Apple Safari, Google Chrome, Mozilla Firefox, and Opera all support many HTML5 features and Internet Explorer 9.0 will also have support for some HTML5 functionality.The mobile web browsers that come pre-installed on iPhones, iPads, and Android phones all have excellent support for HTML5.
New Features 

HTML5 introduces a number of new elements and attributes that helps in building a modern website. Following are great features introduced in HTML5.


New Semantic Elements − These are like <header>, <footer>, and <section>.


Forms 2.0 − Improvements to HTML web forms where new attributes have been introduced for <input> tag.


Persistent Local Storage − To achieve without resorting to third-party plugins.


WebSocket − A a next-generation bidirectional communication technology for web applications.


Server-Sent Events − HTML5 introduces events which flow from web server to the web browsers and they are called Server-Sent Events (SSE).


Canvas − This supports a two-dimensional drawing surface that you can program with JavaScript.


Audio & Video − You can embed audio or video on your web pages without resorting to third-party plugins.


Geolocation − Now visitors can choose to share their physical location with your web application.


Microdata − This lets you create your own vocabularies beyond HTML5 and extend your web pages with custom semantics.


Drag and drop − Drag and drop the items from one location to another location on a the same webpage.
Backward Compatibility

HTML5 is designed, as much as possible, to be backward compatible with existing web browsers. New features build on existing features and allow you to provide fallback content for older browsers.

It is suggested to detect support for individual HTML5 features using a few lines of JavaScript.

HTML 5 introduction and Lesson 1

HTML 5


HTML5 is the latest and most enhanced version of HTML.Technically, HTML is not a programming language, but rather a mark up language.
Audience.
This tutorial has been designed for beginners in HTML5 providing the basic to advanced concepts of the subject.
Prerequisites

Before starting this tutorial you should be aware of the basic understanding of HTML and its tags
Execute HTML5 Online.


You do not need to have your own environment to start learning HTML5 programming! We have set up an on-line compiler for you that can be used to compile and execute the programs on-line.
For most of the examples available in this tutorial, you will find a Try it option at the top right corner of the code box. Use it to verify the programs and check the outcome with different options. Feel free to modify any example and execute it online.

<!DOCTYPE html>
<html>

   <head>
      <meta charset="utf-8">
      <title>CHILDLIKE GIRL</title>
   </head>
   
   <body>   
  
      <header role="banner">
         <h1>HTML5 Document Structure Example</h1>
         <p>This page should be tried in safari, chrome or Mozila.</p>
      </header>
     
      <footer>
         <p>Created by <a href="http://tutorialspoint.com/">Tutorials Point</a></p>
      </footer>
     
   </body>  
</html> 

NOTE:Wait for next Lesson.