<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2681547179890084254</id><updated>2024-09-08T21:00:26.048-07:00</updated><title type='text'>Web Design, Development, Managment and Analysis</title><subtitle type='html'>This blog contains many types of information about Website Design, Development, Management &amp;amp; Analysis Process or Tips... and this is free for Public to speak hare...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>32</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-1016829250157038592</id><published>2014-01-27T03:29:00.002-08:00</published><updated>2014-01-27T03:29:22.849-08:00</updated><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;userContentWrapper aboveUnitContent&quot; data-ft=&quot;{&amp;quot;tn&amp;quot;:&amp;quot;K&amp;quot;}&quot;&gt;
&lt;div class=&quot;_wk mbm&quot;&gt;
&lt;span class=&quot;userContent&quot;&gt;Just click on this link and setup a free account for monthly pay out ...it&#39;s absolutely free... so don&#39;t wait.&lt;br /&gt; &lt;br /&gt; &lt;a href=&quot;http://getmonthlypay.com/index.php?invite=133361&quot; rel=&quot;nofollow nofollow&quot; target=&quot;_blank&quot;&gt;http://getmonthlypay.com/index.php?invite=133361&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;_wk _5rny attachmentUnit&quot;&gt;
&lt;div&gt;
&lt;div class=&quot;userContentWrapper&quot;&gt;
&lt;div&gt;
&lt;span&gt;&lt;br /&gt;&lt;/span&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;photoUnit clearfix belowUnitContent&quot;&gt;
&lt;div class=&quot;_53s uiScaledThumb photo photoWidth1&quot; data-ft=&quot;{&amp;quot;tn&amp;quot;:&amp;quot;E&amp;quot;}&quot; data-gt=&quot;{&amp;quot;fbid&amp;quot;:&amp;quot;10202996237497179&amp;quot;}&quot;&gt;
&lt;a class=&quot;_6i9&quot; href=&quot;https://www.facebook.com/photo.php?fbid=10202996237497179&amp;amp;set=a.2176609865073.2124337.1541664919&amp;amp;type=1&amp;amp;relevant_count=1&quot; rel=&quot;theater&quot;&gt;&lt;div class=&quot;uiScaledImageContainer photoWrap&quot; style=&quot;height: 207px;&quot;&gt;
&lt;img alt=&quot;Photo: http://getmonthlypay.com/index.php?invite=133361&quot; class=&quot;img&quot; height=&quot;207&quot; src=&quot;https://fbcdn-sphotos-e-a.akamaihd.net/hphotos-ak-prn2/t1/p480x480/8203_10202996237497179_523537571_n.jpg&quot; style=&quot;left: -108px;&quot; width=&quot;720&quot; /&gt;&lt;/div&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/1016829250157038592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/1016829250157038592' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/1016829250157038592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/1016829250157038592'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2014/01/just-click-on-this-link-and-setup-free.html' title=''/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-6030808821480472594</id><published>2012-02-14T02:03:00.000-08:00</published><updated>2012-02-14T02:03:11.998-08:00</updated><title type='text'>Create an Image Rotator with Description (CSS/jQuery)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;

  
  

   


    &lt;br /&gt;
&lt;h1&gt;
Create an Image Rotator with Description (CSS/jQuery)&lt;/h1&gt;
&lt;span class=&quot;info&quot;&gt;By &lt;a href=&quot;http://designm.ag/author/sohtanaka/&quot;&gt;Soh Tanaka&lt;/a&gt; | Published May 4th, 2009 in &lt;a href=&quot;http://designm.ag/category/tutorials/&quot; rel=&quot;category tag&quot; title=&quot;View all posts in Tutorials&quot;&gt;Tutorials&lt;/a&gt;&lt;/span&gt;
    
    



&lt;div class=&quot;bsap_1252038 bsap&quot; id=&quot;bsap_1252038&quot;&gt;
&lt;div class=&quot;bsap_adhere&quot;&gt;
&lt;a href=&quot;http://buysellads.com/buy/detail/576/zone/1252038?utm_source=site_576&amp;amp;utm_medium=website&amp;amp;utm_campaign=cpmadhere&amp;amp;utm_content=zone_1252038&quot;&gt;advertise here&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;dd_post_share&quot;&gt;
&lt;div class=&quot;dd_buttons&quot;&gt;
&lt;div class=&quot;dd_button&quot;&gt;
 &lt;span class=&quot;db-wrapper db-clear db-compact&quot;&gt;&lt;span&gt;&lt;span class=&quot;db-container&quot;&gt;&lt;span class=&quot;db-body db-compact&quot;&gt;&lt;span class=&quot;db-count&quot;&gt;5&lt;/span&gt;&lt;a class=&quot;db-anchor&quot; href=&quot;&quot;&gt;digg&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
An
 image rotator is one great way to display portfolio pieces, eCommerce 
product images, or even as an image gallery. Although there are many 
great plugins already, this tutorial will help you understand how the 
image rotator works and helps you create your own from scratch.&lt;br /&gt;

&lt;h3 class=&quot;clear&quot;&gt;
Creating an Image Rotator&lt;/h3&gt;
&lt;strong&gt;&lt;a href=&quot;http://www.sohtanaka.com/web-design/examples/image-rotator/&quot; target=&quot;_blank&quot;&gt;View Demo of Image Rotator&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;

&lt;a href=&quot;http://www.sohtanaka.com/web-design/examples/image-rotator/&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Image Rotator - CSS jQuery&quot; class=&quot;imgborder&quot; src=&quot;http://www.sohtanaka.com/web-design/examples/image-rotator/preview_main.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

&lt;h3&gt;
Step1. HTML – Image Rotator Wireframe&lt;/h3&gt;
Start by building the html wireframe of the layout. As you can see in
 the image below, there will be two major sections (the main image 
section and the thumbnail list section). In addition to the sections for
 images, the third section, labeled “desc”, will contain the main_image 
description.&lt;br /&gt;

&lt;img alt=&quot;Image Rotator - CSS jQuery&quot; class=&quot;imgborder&quot; src=&quot;http://www.sohtanaka.com/web-design/examples/image-rotator/html_preview.jpg&quot; /&gt;&lt;br /&gt;

&lt;strong&gt;main_image Section HTML&lt;/strong&gt;&lt;br /&gt;

&lt;code lang=&quot;html&quot;&gt;
&lt;div class=&quot;main_image&quot;&gt;

 &lt;img alt=&quot;&quot; src=&quot;http://designm.ag/tutorials/image-rotator-css-jquery/banner1.jpg&quot; /&gt;
&lt;div class=&quot;desc&quot;&gt;

  &lt;a class=&quot;collapse&quot; href=&quot;http://designm.ag/tutorials/image-rotator-css-jquery/#&quot;&gt;Close Me!&lt;/a&gt;
&lt;div class=&quot;block&quot;&gt;

&lt;h2&gt;
Title&lt;/h2&gt;
&lt;small&gt;Date&lt;/small&gt;&lt;br /&gt;

Copy&lt;br /&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/code&gt;&lt;code lang=&quot;html&quot;&gt;&lt;/code&gt;&lt;br /&gt;

&lt;strong&gt;image_thumb Section HTML&lt;/strong&gt;&lt;br /&gt;
Note – The thumbnail list section will be very similar in markup as the 
main image section, but each will all be encapsulated in its own list 
item.&lt;br /&gt;

&lt;code lang=&quot;html&quot;&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div class=&quot;image_thumb&quot;&gt;
&lt;code lang=&quot;html&quot;&gt;
&lt;ul&gt;
&lt;li&gt;
   &lt;a href=&quot;http://designm.ag/tutorials/image-rotator-css-jquery/banner1.jpg&quot;&gt;&lt;img alt=&quot;Image Name&quot; src=&quot;http://designm.ag/tutorials/image-rotator-css-jquery/banner1_thumb.jpg&quot; /&gt;&lt;/a&gt;
&lt;div class=&quot;block&quot;&gt;

&lt;h2&gt;
Title&lt;/h2&gt;
&lt;small&gt;Date&lt;/small&gt;&lt;br /&gt;

Copy&lt;br /&gt;

&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;code lang=&quot;html&quot;&gt;
&lt;/code&gt;&lt;code lang=&quot;html&quot;&gt;&lt;/code&gt;&lt;br /&gt;


&lt;ins style=&quot;border: none; display: inline-table; height: 250px; margin: 0; padding: 0; position: relative; visibility: visible; width: 300px;&quot;&gt;&lt;ins id=&quot;aswift_0_anchor&quot; style=&quot;border: none; display: block; height: 250px; margin: 0; padding: 0; position: relative; visibility: visible; width: 300px;&quot;&gt;&lt;/ins&gt;&lt;/ins&gt;&lt;br /&gt;

&lt;h3&gt;
Step 2. CSS – Image Rotator Wireframe&lt;/h3&gt;
Next, it’s time to style the image rotator’s HTML wireframe with CSS.&lt;br /&gt;

&lt;strong&gt;main_image section CSS&lt;/strong&gt;&lt;br /&gt;

&lt;code lang=&quot;css&quot;&gt;.main_image {&lt;br /&gt;
 width: 598px;&lt;br /&gt;
 height: 456px;&lt;br /&gt;
 float: left;&lt;br /&gt;
 background: #333;&lt;br /&gt;
 position: relative;&lt;br /&gt;
 overflow: hidden; /*--Overflow hidden allows the description to toggle/tuck away as it slides down--*/&lt;br /&gt;
 color: #fff;&lt;br /&gt;
}&lt;br /&gt;
.main_image h2 {&lt;br /&gt;
 font-size: 2em;&lt;br /&gt;
 font-weight: normal;&lt;br /&gt;
 margin: 0 0 5px;&lt;br /&gt;
 padding: 10px;&lt;br /&gt;
}&lt;br /&gt;
.main_image p {&lt;br /&gt;
 font-size: 1.2em;&lt;br /&gt;
 line-height: 1.6em;&lt;br /&gt;
 padding: 10px;&lt;br /&gt;
 margin: 0;&lt;br /&gt;
}&lt;br /&gt;
.block small { /*--We&#39;ll be using this same style on our thumbnail list--*/&lt;br /&gt;
 font-size: 1em;&lt;br /&gt;
 padding: 0 0 0 20px;&lt;br /&gt;
 background: url(icon_calendar.gif) no-repeat 0 center;&lt;br /&gt;
}&lt;br /&gt;
.main_image .block small {margin-left: 10px;}&lt;br /&gt;
.main_image .desc{&lt;br /&gt;
 position: absolute;&lt;br /&gt;
 bottom: 0;&lt;br /&gt;
 left: 0; /*--Stick the desc class to the bottom of our main image container--*/&lt;br /&gt;
 width: 100%;&lt;br /&gt;
 display: none; /*--Hide description by default, if js is enabled, we will show this--*/&lt;br /&gt;
}&lt;br /&gt;
.main_image .block{&lt;br /&gt;
 width: 100%;&lt;br /&gt;
 background: #111;&lt;br /&gt;
 border-top: 1px solid #000;&lt;br /&gt;
}&lt;br /&gt;
.main_image a.collapse { /*--This is our hide/show tab--*/&lt;br /&gt;
 background: url(btn_collapse.gif) no-repeat left top;&lt;br /&gt;
 height: 27px;&lt;br /&gt;
 width: 93px;&lt;br /&gt;
 text-indent: -99999px;&lt;br /&gt;
 position: absolute;&lt;br /&gt;
 top: -27px;&lt;br /&gt;
 right: 20px;&lt;br /&gt;
}&lt;br /&gt;
.main_image a.show {background-position: left bottom;}&lt;/code&gt;&lt;br /&gt;

&lt;strong&gt;image_thumb section CSS&lt;/strong&gt;&lt;br /&gt;

&lt;code lang=&quot;css&quot;&gt;.image_thumb {&lt;br /&gt;
 float: left;&lt;br /&gt;
 width: 299px;&lt;br /&gt;
 background: #f0f0f0;&lt;br /&gt;
 border-right: 1px solid #fff;&lt;br /&gt;
 border-top: 1px solid #ccc;&lt;br /&gt;
}&lt;br /&gt;
.image_thumb img {&lt;br /&gt;
 border: 1px solid #ccc;&lt;br /&gt;
 padding: 5px;&lt;br /&gt;
 background: #fff;&lt;br /&gt;
 float: left;&lt;br /&gt;
}&lt;br /&gt;
.image_thumb ul {&lt;br /&gt;
 margin: 0;&lt;br /&gt;
 padding: 0;&lt;br /&gt;
 list-style: none;&lt;br /&gt;
}&lt;br /&gt;
.image_thumb ul li{&lt;br /&gt;
 margin: 0;&lt;br /&gt;
 padding: 12px 10px;&lt;br /&gt;
 background: #f0f0f0 url(nav_a.gif) repeat-x;&lt;br /&gt;
 width: 279px;&lt;br /&gt;
 float: left;&lt;br /&gt;
 border-bottom: 1px solid #ccc;&lt;br /&gt;
 border-top: 1px solid #fff;&lt;br /&gt;
 border-right: 1px solid #ccc;&lt;br /&gt;
}&lt;br /&gt;
.image_thumb ul li.hover { /*--Hover State--*/&lt;br /&gt;
 background: #ddd;&lt;br /&gt;
 cursor: pointer;&lt;br /&gt;
}&lt;br /&gt;
.image_thumb ul li.active { /*--Active State--*/&lt;br /&gt;
 background: #fff;&lt;br /&gt;
 cursor: default;&lt;br /&gt;
}&lt;br /&gt;
html .image_thumb ul li h2 {&lt;br /&gt;
 font-size: 1.5em;&lt;br /&gt;
 margin: 5px 0;&lt;br /&gt;
 padding: 0;&lt;br /&gt;
}&lt;br /&gt;
.image_thumb ul li .block {&lt;br /&gt;
 float: left;&lt;br /&gt;
 margin-left: 10px;&lt;br /&gt;
 padding: 0;&lt;br /&gt;
 width: 170px;&lt;br /&gt;
}&lt;br /&gt;
.image_thumb ul li p{display: none;}/*--Hide the description on the list items--*/&lt;/code&gt;&lt;br /&gt;

&lt;h3&gt;
Step3. jQuery – Image Rotation Effect&lt;/h3&gt;
If you are new to jQuery or have not had much experience with it, first go over &lt;a href=&quot;http://docs.jquery.com/Main_Page&quot; target=&quot;_blank&quot;&gt;the basics&lt;/a&gt;.&lt;br /&gt;

&lt;strong&gt;Show Image Description and Set Transparency on Block&lt;/strong&gt;&lt;br /&gt;
To degrade gracefully, the image banner description is set to be hidden 
at default with CSS (refer to the “.main_image .desc” class in the CSS).
 We will show the image description if JavaScript is enabled.&lt;br /&gt;

&lt;code lang=&quot;javascript&quot;&gt;&lt;br /&gt;
$(&quot;.main_image .desc&quot;).show(); //Show Banner&lt;br /&gt;
$(&quot;.main_image .block&quot;).animate({ opacity: 0.85 }, 1 ); //Set Opacity&lt;/code&gt;&lt;br /&gt;

&lt;strong&gt;Click and Hover Events for Image List&lt;/strong&gt;&lt;br /&gt;
The following script will change the main_image when a list-item in the 
image_thumb is clicked. Each line also contains a comment explaining 
which jQuery actions are being performed.&lt;br /&gt;

&lt;code lang=&quot;javascript&quot;&gt;$(&quot;.image_thumb ul li:first&quot;).addClass(&#39;active&#39;); //Add the active class (highlights the very first list item by default)&lt;br /&gt;
$(&quot;.image_thumb ul li&quot;).click(function(){&lt;br /&gt;
 //Set Variables&lt;br /&gt;
 var imgAlt = $(this).find(&#39;img&#39;).attr(&quot;alt&quot;); //Get Alt Tag of Image&lt;br /&gt;
 var imgTitle = $(this).find(&#39;a&#39;).attr(&quot;href&quot;); //Get Main Image URL&lt;br /&gt;
 var imgDesc = $(this).find(&#39;.block&#39;).html();  //Get HTML of the &quot;block&quot; container&lt;br /&gt;
 var imgDescHeight = $(&quot;.main_image&quot;).find(&#39;.block&#39;).height(); //Find the height of the &quot;block&quot;&lt;/code&gt;&lt;br /&gt;
&lt;code lang=&quot;javascript&quot;&gt;
 if ($(this).is(&quot;.active&quot;)) {  //If the list item is active/selected, then...&lt;br /&gt;
  return false; // Don&#39;t click through - Prevents repetitive animations on active/selected list-item&lt;br /&gt;
 } else { //If not active then...&lt;br /&gt;
  //Animate the Description&lt;br /&gt;
  $(&quot;.main_image .block&quot;).animate({ opacity: 0, marginBottom: 
-imgDescHeight }, 250 , function() { //Pull the block down (negative 
bottom margin of its own height)&lt;br /&gt;
   $(&quot;.main_image .block&quot;).html(imgDesc).animate({ opacity: 0.85, 
marginBottom: &quot;0&quot; }, 250 ); //swap the html of the block, then pull the 
block container back up and set opacity&lt;br /&gt;
   $(&quot;.main_image img&quot;).attr({ src: imgTitle , alt: imgAlt}); //Switch the main image (URL + alt tag)&lt;br /&gt;
  });&lt;br /&gt;
 }&lt;br /&gt;
 //Show active list-item&lt;br /&gt;
 $(&quot;.image_thumb ul li&quot;).removeClass(&#39;active&#39;); //Remove class of &#39;active&#39; on all list-items&lt;br /&gt;
 $(this).addClass(&#39;active&#39;);  //Add class of &#39;active&#39; on the selected list&lt;br /&gt;
 return false; &lt;br /&gt;

&lt;/code&gt;&lt;code lang=&quot;javascript&quot;&gt;}) .hover(function(){ //Hover effects on list-item&lt;br /&gt;
 $(this).addClass(&#39;hover&#39;); //Add class &quot;hover&quot; on hover&lt;br /&gt;
 }, function() {&lt;br /&gt;
 $(this).removeClass(&#39;hover&#39;); //Remove class &quot;hover&quot; on hover out&lt;br /&gt;
});&lt;/code&gt;&lt;br /&gt;

&lt;strong&gt;Toggle the Hide/Show Option&lt;/strong&gt;&lt;br /&gt;
This is fairly simple. On each click, either show or hide the description.&lt;br /&gt;

&lt;code lang=&quot;javascript&quot;&gt;&lt;br /&gt;
$(&quot;a.collapse&quot;).click(function(){&lt;br /&gt;
 $(&quot;.main_banner .block&quot;).slideToggle(); //Toggle the description (slide up and down)&lt;br /&gt;
 $(&quot;a.collapse&quot;).toggleClass(&quot;show&quot;); //Toggle the class name of &quot;show&quot; (the hide/show tab)&lt;br /&gt;
});&lt;/code&gt;&lt;br /&gt;

&lt;strong&gt;&lt;a href=&quot;http://www.sohtanaka.com/web-design/examples/image-rotator/&quot; target=&quot;_blank&quot;&gt;View Demo of Image Rotator&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;

&lt;a href=&quot;http://www.sohtanaka.com/web-design/examples/image-rotator/&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Image Rotator - CSS jQuery&quot; class=&quot;imgborder&quot; src=&quot;http://www.sohtanaka.com/web-design/examples/image-rotator/preview_main.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

&lt;h3&gt;
Conclusion&lt;/h3&gt;
Do keep in mind these jQuery driven image rotators do not degrade in 
the best fashion. As you can see, when you disable JavaScript, each 
thumbnail must be clicked on to get the larger image (which opens in the
 same window). But for those who have a user base with JavaScript 
enabled, you are in the clear and it can be used and customized to fit 
various scenarios.&lt;br /&gt;

Experiment and customize this to fit your needs. If you have any 
questions, concerns, suggestions, or comments, please do not hesitate to
 let me know.&lt;br /&gt;
Awesome &lt;a href=&quot;http://www.rackspace.co.uk/cloud-hosting&quot; title=&quot;uk cloud hosting&quot;&gt;cloud hosting&lt;/a&gt; for designers and their files and apps.&lt;br /&gt;

Credits: Much appreciation to &lt;a href=&quot;http://store.glennz.com/&quot; target=&quot;_blank&quot;&gt;Glenn Jones&lt;/a&gt; for allowing me to use his beautiful illustrations for the example images.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/6030808821480472594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/6030808821480472594' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/6030808821480472594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/6030808821480472594'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/02/create-image-rotator-with-description.html' title='Create an Image Rotator with Description (CSS/jQuery)'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-5938836128206836778</id><published>2012-02-12T04:02:00.000-08:00</published><updated>2012-02-12T04:02:48.611-08:00</updated><title type='text'>An Introduction to CSS 3-D Transforms</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div id=&quot;article&quot;&gt;

                 Ladies and gentlemen, it is the second decade of the
 third millennium and we are still kicking around the same 2-D interface
 we got three decades ago. Sure, Apple debuted a few apps for &lt;span class=&quot;caps&quot;&gt;OSX&lt;/span&gt; 10.7 that have a couple more 3-D flourishes, and Microsoft has had that &lt;a href=&quot;http://windows.microsoft.com/en-US/windows-vista/Using-Windows-Flip-3D&quot;&gt;Flip 3D&lt;/a&gt; for a while. But c’mon – 2011 is right around the corner. That’s &lt;em&gt;Twenty Eleven&lt;/em&gt;, folks. Where is our 3-D virtual reality? By now, we should be zipping around the &lt;a href=&quot;http://en.wikipedia.org/wiki/Snow_Crash&quot;&gt;Metaverse on super-sonic motorbikes&lt;/a&gt;.&lt;br /&gt;


 Granted, the capability of rendering complex 3-D environments has 
been present for years. On the web, there are already several solutions:
 &lt;a href=&quot;http://www.adobe.com/devnet/flash/3d_animation.html&quot;&gt;Flash&lt;/a&gt;; &lt;a href=&quot;https://github.com/mrdoob/three.js/&quot;&gt;three.js&lt;/a&gt; in &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt;; and, eventually, &lt;a href=&quot;http://www.khronos.org/webgl/&quot;&gt;WebGL&lt;/a&gt;. Finally, we meagre front-end developers have our own three-dimensional jewel: &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; 3-D transforms!&lt;br /&gt;


 &lt;h3&gt;
Rationale&lt;/h3&gt;
Like a beautiful jewel, 3-D transforms can be dazzling, a true 
spectacle to behold. But before we start tacking 3-D diamonds and rubies
 to our compositions like &lt;a href=&quot;http://www.liberace.org/&quot;&gt;Liberace&lt;/a&gt;‘s tailor, we owe it to our users to ask how they can benefit from this awesome feature. &lt;br /&gt;


 An entire application should not take advantage of 3-D transforms. &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 was built to style documents, not generate explorable environments. I 
fail to find a benefit to completing a web form that can be accessed by 
swivelling my viewport to the Sign-Up Room (although there have been 
proposals to make the web just that). Nevertheless, there are plenty of 
opportunities to use 3-D transforms &lt;em&gt;in between&lt;/em&gt; interactions with the interface, via transitions.&lt;br /&gt;


 Take, for instance, the Weather App on the iPhone. The application 
uses two views: a details view; and an options view. Switching between 
these two views is done with a 3-D flip transition. This informs the 
user that the interface has two – and only two – views, as they can 
exist only on either side of the same plane.&lt;br /&gt;


 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;iPhone Weather App 3D flip transition&quot; src=&quot;http://media.24ways.org/2010/desandro/weather-app-transition.jpg&quot; /&gt; &lt;span class=&quot;caption&quot;&gt;Flipping from details view to options view via a 3-D transition&lt;/span&gt;&lt;/div&gt;
Also, consider slide shows. When you’re looking at the last slide, 
what cues tip you off that advancing will restart the cycle at the first
 slide? A better paradigm might be achieved with a 3-D transform, 
placing the slides side-by-side in a circle (carousel) in 
three-dimensional space; in that arrangement, the last slide obviously 
comes before the first.&lt;br /&gt;


 3-D transforms are more than just eye candy. We can also use them to solve dilemmas and make our applications more intuitive. &lt;br /&gt;


 &lt;h3&gt;
Current support&lt;/h3&gt;
The &lt;a href=&quot;http://www.w3.org/TR/css3-3d-transforms/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; 3D Transforms module&lt;/a&gt;
 has been out in the wild for over a year now. Currently, only Safari 
supports the specification – which includes Safari on Mac OS X and 
Mobile Safari on iOS. &lt;br /&gt;


 The support roadmap for other browsers varies. The Mozilla team has &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=505115&quot;&gt;taken some initial steps&lt;/a&gt; towards implementing the module. &lt;a href=&quot;http://twitter.com/miketaylr&quot;&gt;Mike Taylor&lt;/a&gt; tells me that the Opera team is keeping a close eye on &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 transforms, and is waiting until the specification is fleshed out. And 
our best friend Internet Explorer still needs to catch up to 2-D 
transforms before we can talk about the 3-D variety.&lt;br /&gt;


 To make matters more perplexing, Safari’s WebKit cousin Chrome 
currently accepts 3-D transform declarations, but renders them in 2-D 
space. Chrome team member &lt;a href=&quot;http://twitter.com/paul_irish&quot;&gt;Paul Irish&lt;/a&gt;, says that 3-D transforms are on the horizon, perhaps in one of the next 8.0 releases.&lt;br /&gt;


 This all adds up to a bit of a challenge for those of us excited by 
3-D transforms. I’ll give it to you straight: missing the dimension of 
depth can make degradation a bit ungraceful. Unless the transform is 
relatively simple and holds up in non-3D-supporting browsers, you’ll 
most likely have to design another solution. But what’s another hurdle 
in a steeplechase? We web folk have had our mettle tested for years. 
We’re prepared to devise multiple solutions.&lt;br /&gt;


 Here’s the part of the article where I mention &lt;a href=&quot;http://modernizr.com/&quot;&gt;Modernizr&lt;/a&gt;,
 and you brush over it because you’ve read this part of an article 
hundreds of times before. But seriously, it’s the best way to test for &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; 3-D transform support. Use it.&lt;br /&gt;


 Even with these difficulties mounting up, trying out 3-D transforms today is the right move. The &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; 3-D transforms module was developed by the same team at Apple that produced the &lt;a href=&quot;http://www.w3.org/TR/css3-2d-transforms/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; 2D Transforms&lt;/a&gt; and &lt;a href=&quot;http://www.w3.org/TR/css3-animations/&quot;&gt;Animation&lt;/a&gt;
 modules. Both specifications have since been adopted by Mozilla and 
Opera. Transforming in three-dimensions now will guarantee you’ll be 
ahead of the game when the other browsers catch up.&lt;br /&gt;


 The choice is yours. You can make excuses and pooh-pooh 3-D 
transforms because they’re too hard and only snobby Apple fans will see 
them today. Or, with a &lt;a href=&quot;http://hardboiledwebdesign.com/&quot;&gt;tip of the fedora to Mr Andy Clarke&lt;/a&gt;, you can get hard-boiled and start designing with the best features out there right this instant.&lt;br /&gt;


 So, I bid you, &lt;a href=&quot;http://tfwiki.net/wiki/Roll_out&quot;&gt;in the words of the eternal Optimus Prime&lt;/a&gt;…&lt;br /&gt;


 &lt;blockquote&gt;

  Transform and roll out.&lt;br /&gt;

 &lt;/blockquote&gt;
Let’s get coding.&lt;br /&gt;


 &lt;h3&gt;
Perspective&lt;/h3&gt;
To activate 3-D space, an element needs perspective. This can be applied in two ways: using the &lt;code&gt;transform&lt;/code&gt; property, with the perspective as a functional notation:&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;-webkit-transform: perspective(600);
&lt;/code&gt;&lt;/pre&gt;
or using the &lt;code&gt;perspective&lt;/code&gt; property: &lt;br /&gt;


&lt;pre&gt;&lt;code&gt;-webkit-perspective: 600;
&lt;/code&gt;&lt;/pre&gt;
&lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/perspective-01.html&quot;&gt;&lt;strong&gt;See example: Perspective 1.&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/perspective-01.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;Perspective example&quot; src=&quot;http://media.24ways.org/2010/desandro/perspective01.png&quot; /&gt; &lt;span class=&quot;caption&quot;&gt;The red element on the left uses &lt;code&gt;transform: perspective()&lt;/code&gt; functional notation; the blue element on the right uses the &lt;code&gt;perspective&lt;/code&gt; property&lt;/span&gt;&lt;/div&gt;
&lt;/a&gt;

 These two formats both trigger a 3-D space, but there is a 
difference. The first, functional notation is convenient for directly 
applying a 3-D transform on a single element (in &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/perspective-01.html&quot;&gt;the previous example&lt;/a&gt;, I use it in conjunction with a &lt;code&gt;rotateY&lt;/code&gt; transform). But when used on multiple elements, the transformed elements don’t line up as expected. If you use the same &lt;code&gt;transform&lt;/code&gt; across elements with different positions, each element will have its own vanishing point. To remedy this, use the &lt;code&gt;perspective&lt;/code&gt; property on a parent element, so each child shares the same 3-D space.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/perspective-02-children.html&quot;&gt;&lt;strong&gt;See Example: Perspective 2.&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/perspective-02-children.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;Perspective example&quot; src=&quot;http://media.24ways.org/2010/desandro/perspective-children01.png&quot; /&gt; &lt;span class=&quot;caption&quot;&gt;Each
 red box on the left has its own vanishing point within the parent 
container; the blue boxes on the right share the vanishing point of the 
parent container&lt;/span&gt;&lt;/div&gt;
&lt;/a&gt;

 The value of &lt;code&gt;perspective&lt;/code&gt; determines the intensity of 
the 3-D effect. Think of it as a distance from the viewer to the object.
 The greater the value, the further the distance, so the less intense 
the visual effect. &lt;code&gt;perspective: 2000;&lt;/code&gt; yields a subtle 3-D effect, as if we were viewing an object from far away. &lt;code&gt;perspective: 100;&lt;/code&gt; produces a tremendous 3-D effect, like a tiny insect viewing a massive object.&lt;br /&gt;


 By default, the vanishing point for a 3-D space is positioned at its
 centre. You can change the position of the vanishing point with &lt;code&gt;perspective-origin&lt;/code&gt; property.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;-webkit-perspective-origin: 25% 75%;
&lt;/code&gt;&lt;/pre&gt;
&lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/perspective-03.html&quot;&gt;&lt;strong&gt;See Example: Perspective 3.&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/perspective-03.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;Intense perspective value, with vanishing point modified&quot; src=&quot;http://media.24ways.org/2010/desandro/perspective02.png&quot; /&gt;&lt;/div&gt;
&lt;/a&gt;

 &lt;h3&gt;
3-D transform functions&lt;/h3&gt;
As a web designer, you’re probably well acquainted with working in 
two dimensions, X and Y, positioning items horizontally and vertically. 
With a 3-D space initialised with &lt;code&gt;perspective&lt;/code&gt;, we can now transform elements in all three glorious spatial dimensions, including the third Z dimension, depth. &lt;br /&gt;


 3-D transforms use the same &lt;code&gt;transform&lt;/code&gt; property used for 2-D transforms. If you’re familiar with 2-D transforms, you’ll find the basic &lt;a href=&quot;http://www.w3.org/TR/css3-3d-transforms/#transform-functions&quot;&gt;3D transform functions&lt;/a&gt; fairly similar. &lt;br /&gt;


 &lt;ul&gt;
&lt;li&gt;&lt;code&gt;rotateX(angle)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rotateY(angle)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rotateZ(angle)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;translateZ(tz)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;scaleZ(sz)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
Whereas &lt;code&gt;translateX()&lt;/code&gt; positions an element along the horizontal X-axis, &lt;code&gt;translateZ()&lt;/code&gt;
 positions it along the Z-axis, which runs front to back in 3-D space. 
Positive values position the element closer to the viewer, negative 
values further away.&lt;br /&gt;


 The &lt;code&gt;rotate&lt;/code&gt; functions rotate the element around the 
corresponding axis. This is somewhat counter-intuitive at first, as you 
might imagine that &lt;code&gt;rotateX&lt;/code&gt; will spin an object left to right. Instead, using &lt;code&gt;rotateX(45deg)&lt;/code&gt; rotates an element &lt;em&gt;around&lt;/em&gt; the horizontal X-axis, so the top of the element angles back and away, and the bottom gets closer to the viewer.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/transforms-01-functions.html&quot;&gt;&lt;strong&gt;See Example: Transforms 1.&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/transforms-01-functions.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;CSS 3D transform functions&quot; src=&quot;http://media.24ways.org/2010/desandro/transforms01.png&quot; /&gt;&lt;span class=&quot;caption&quot;&gt;3-D &lt;code&gt;rotate()&lt;/code&gt; and &lt;code&gt;translate()&lt;/code&gt; functions around each axis&lt;/span&gt;&lt;/div&gt;
&lt;/a&gt;

 There are also several shorthand &lt;code&gt;transform&lt;/code&gt; functions that require values for all three dimensions:&lt;br /&gt;


 &lt;ul&gt;
&lt;li&gt;&lt;code&gt;translate3d(tx,ty,tz)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;scale3d(sx,sy,sz)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rotate3d(rx,ry,rz,angle)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;Pro-tip:&lt;/strong&gt; These &lt;code&gt;foo3d()&lt;/code&gt; transform functions also have the benefit of triggering hardware acceleration in Safari. Dean Jackson, &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; 3-D transform spec author and main WebKit dude, writes (to &lt;a href=&quot;http://mir.aculo.us/2010/08/05/html5-buzzwords-in-action/&quot;&gt;Thomas Fuchs&lt;/a&gt;):&lt;br /&gt;


 &lt;blockquote&gt;

  In essence, any transform that has a 3D operation as one of its 
functions will trigger hardware compositing, even when the actual 
transform is 2D, or not doing anything at all (such as &lt;code&gt;translate3d(0,0,0)&lt;/code&gt;).
 Note this is just current behaviour, and could change in the future 
(which is why we don’t document or encourage it). But it is very helpful
 in some situations and can significantly improve redraw performance.&lt;br /&gt;

 &lt;/blockquote&gt;
For the sake of simplicity, my demos will use the basic transform functions, but if you’re writing production-ready &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; for iOS or Safari-only, &lt;strong&gt;make sure to use the &lt;code&gt;foo3d()&lt;/code&gt; functions to get the best rendering performance.&lt;/strong&gt;&lt;br /&gt;


 &lt;h3&gt;
Card flip&lt;/h3&gt;
We now have all the tools to start making 3-D objects. Let’s get started with something simple: flipping a card.&lt;br /&gt;


 Here’s the basic markup we’ll need:&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;container&quot;&amp;gt;
  &amp;lt;div id=&quot;card&quot;&amp;gt;
    &amp;lt;figure class=&quot;front&quot;&amp;gt;1&amp;lt;/figure&amp;gt;
    &amp;lt;figure class=&quot;back&quot;&amp;gt;2&amp;lt;/figure&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
The &lt;code&gt;.container&lt;/code&gt; will house the 3-D space. The &lt;code&gt;#card&lt;/code&gt; acts as a wrapper for the 3-D object. Each face of the card has a separate element: &lt;code&gt;.front&lt;/code&gt;; and &lt;code&gt;.back&lt;/code&gt;.
 Even for such a simple object, I recommend using this same pattern for 
any 3-D transform. Keeping the 3-D space element and the object 
element(s) separate establishes a pattern that is simple to understand 
and easier to style.&lt;br /&gt;


 We’re ready for some 3-D stylin’. First, apply the necessary &lt;code&gt;perspective&lt;/code&gt; to the parent 3-D space, along with any size or positioning styles.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;.container { 
  width: 200px;
  height: 260px;
  position: relative;
  -webkit-perspective: 800;
}
&lt;/code&gt;&lt;/pre&gt;
Now the &lt;code&gt;#card&lt;/code&gt; element can be transformed in its 
parent’s 3-D space. We’re combining absolute and relative positioning so
 the 3-D object is removed from the flow of the document. We’ll also add
 &lt;code&gt;width: 100%;&lt;/code&gt;  and &lt;code&gt;height: 100%;&lt;/code&gt;. This ensures the object’s &lt;code&gt;transform-origin&lt;/code&gt; will occur in the centre of &lt;code&gt;.container&lt;/code&gt;. More on &lt;code&gt;transform-origin&lt;/code&gt; later. &lt;br /&gt;


 Let’s add a CSS3 transition so users can see the transform take effect. &lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#card {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transform-style: preserve-3d;
  -webkit-transition: -webkit-transform 1s;
}
&lt;/code&gt;&lt;/pre&gt;
The &lt;code&gt;.container&lt;/code&gt;’s &lt;code&gt;perspective&lt;/code&gt; only applies to direct descendant children, in this case &lt;code&gt;#card&lt;/code&gt;.
 In order for subsequent children to inherit a parent’s perspective, and
 live in the same 3-D space, the parent can pass along its perspective 
with &lt;code&gt;transform-style: preserve-3d&lt;/code&gt;. Without 3-D &lt;code&gt;transform-style&lt;/code&gt;, the faces of the card would be flattened with its parents and the back face’s rotation would be nullified. &lt;br /&gt;


 To position the faces in 3-D space, we’ll need to reset their positions in 2-D with &lt;code&gt;position: absolute&lt;/code&gt;. In order to hide the reverse sides of the faces when they are faced away from the viewer, we use &lt;code&gt;backface-visibility: hidden&lt;/code&gt;. &lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#card figure {
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
}
&lt;/code&gt;&lt;/pre&gt;
To flip the &lt;code&gt;.back&lt;/code&gt; face, we add a basic 3-D transform of &lt;code&gt;rotateY(180deg)&lt;/code&gt;. &lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#card .front {
  background: red;
}
#card .back {
  background: blue;
  -webkit-transform: rotateY(180deg);
}
&lt;/code&gt;&lt;/pre&gt;
With the faces in place, the &lt;code&gt;#card&lt;/code&gt; requires a corresponding style for when it is flipped.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#card.flipped {
  -webkit-transform: rotateY(180deg);
}
&lt;/code&gt;&lt;/pre&gt;
Now we have a working 3-D object. To flip the card, we can toggle the &lt;code&gt;flipped&lt;/code&gt; class. When &lt;code&gt;.flipped&lt;/code&gt;, the &lt;code&gt;#card&lt;/code&gt; will rotate 180 degrees, thus exposing the &lt;code&gt;.back&lt;/code&gt; face.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/card-01.html&quot;&gt;&lt;strong&gt;See Example: Card 1.&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/card-01.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;3D card flip transition&quot; src=&quot;http://media.24ways.org/2010/desandro/card-flip01.png&quot; /&gt;&lt;span class=&quot;caption&quot;&gt;Flipping a card in three dimensions&lt;/span&gt;&lt;/div&gt;
&lt;/a&gt;

 &lt;h3&gt;
Slide-flip&lt;/h3&gt;
Take another look at the Weather App 3-D transition. You’ll notice that it’s not quite the same effect as &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/card-01.html&quot;&gt;our previous demo&lt;/a&gt;.
 If you follow the right edge of the card, you’ll find that its corners 
stay within the container. Instead of pivoting from the horizontal 
centre, it pivots on that right edge. But the transition is not just a 
rotation – the edge moves horizontally from right to left. We can 
reproduce this transition just by modifying a couple of lines of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; from our original card flip demo.&lt;br /&gt;


 The pivot point for the rotation occurs at the right side of the card. By default, the &lt;code&gt;transform-origin&lt;/code&gt; of an element is at its horizontal and vertical centre (&lt;code&gt;50% 50%&lt;/code&gt; or &lt;code&gt;center center&lt;/code&gt;). Let’s change it to the right side:&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#card { -webkit-transform-origin: right center; }
&lt;/code&gt;&lt;/pre&gt;
That flip now needs some horizontal movement with &lt;code&gt;translateX&lt;/code&gt;. We’ll set the rotation to &lt;code&gt;-180deg&lt;/code&gt; so it flips right side out.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#card.flipped {
  -webkit-transform: translateX(-100%) rotateY(-180deg);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/card-02-slide-flip.html&quot;&gt;&lt;strong&gt;See Example: Card 2&lt;/strong&gt;&lt;/a&gt;.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/card-02-slide-flip.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;3D card slide-flip transition&quot; src=&quot;http://media.24ways.org/2010/desandro/card-flip02.png&quot; /&gt;&lt;span class=&quot;caption&quot;&gt;Creating a slide-flip from the right edge of the card&lt;/span&gt;&lt;/div&gt;
&lt;/a&gt;

 &lt;h3&gt;
Cube&lt;/h3&gt;
Creating 3-D card objects is a good way to get started with 3-D 
transforms. But once you’ve mastered them, you’ll be hungry to push it 
further and create some true 3-D objects: prisms. We’ll start out by 
making a cube.&lt;br /&gt;


 The markup for the cube is similar to the card. This time, however, we need six child elements for all six faces of the cube:&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;section class=&quot;container&quot;&amp;gt;
  &amp;lt;div id=&quot;cube&quot;&amp;gt;
    &amp;lt;figure class=&quot;front&quot;&amp;gt;1&amp;lt;/figure&amp;gt;
    &amp;lt;figure class=&quot;back&quot;&amp;gt;2&amp;lt;/figure&amp;gt;
    &amp;lt;figure class=&quot;right&quot;&amp;gt;3&amp;lt;/figure&amp;gt;
    &amp;lt;figure class=&quot;left&quot;&amp;gt;4&amp;lt;/figure&amp;gt;
    &amp;lt;figure class=&quot;top&quot;&amp;gt;5&amp;lt;/figure&amp;gt;
    &amp;lt;figure class=&quot;bottom&quot;&amp;gt;6&amp;lt;/figure&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
Basic position and size styles set the six faces on top of one another in the container.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;.container {
  width: 200px;
  height: 200px;
  position: relative;
  -webkit-perspective: 1000;
}
#cube {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transform-style: preserve-3d;
}
#cube figure {
  width: 196px;
  height: 196px;
  display: block;
  position: absolute;
  border: 2px solid black;
}
&lt;/code&gt;&lt;/pre&gt;
With the card, we only had to rotate its back face. The cube, 
however, requires that five of the six faces to be rotated. Faces 1 and 2
 will be the front and back. Faces 3 and 4 will be the sides. Faces 5 
and 6 will be the top and bottom.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#cube .front { -webkit-transform: rotateY(0deg); }
#cube .back { -webkit-transform: rotateX(180deg); }
#cube .right { -webkit-transform: rotateY(90deg); }
#cube .left { -webkit-transform: rotateY(-90deg); }
#cube .top { -webkit-transform: rotateX(90deg); }
#cube .bottom { -webkit-transform: rotateX(-90deg); }
&lt;/code&gt;&lt;/pre&gt;
We could remove the first &lt;code&gt;#cube .front&lt;/code&gt; style declaration, as this transform has no effect, but let’s leave it in to keep our code consistent.&lt;br /&gt;


 Now each face is rotated, and only the front face is visible. The 
four side faces are all perpendicular to the viewer, so they appear 
invisible. To push them out to their appropriate sides, they need to be 
translated out from the centre of their positions. Each side of the cube
 is 200 pixels wide. From the cube’s centre they’ll need to be 
translated out half that distance, &lt;code&gt;100px&lt;/code&gt;.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#cube .front { -webkit-transform: rotateY(0deg) translateZ(100px); }
#cube .back { -webkit-transform: rotateX(180deg) translateZ(100px); }
#cube .right { -webkit-transform: rotateY(90deg) translateZ(100px); }
#cube .left { -webkit-transform: rotateY(-90deg) translateZ(100px); }
#cube .top { -webkit-transform: rotateX(90deg) translateZ(100px); }
#cube .bottom { -webkit-transform: rotateX(-90deg) translateZ(100px); }
&lt;/code&gt;&lt;/pre&gt;
Note here that the &lt;code&gt;translateZ&lt;/code&gt; function comes &lt;em&gt;after&lt;/em&gt; the &lt;code&gt;rotate&lt;/code&gt;.
 The order of transform functions is important. Take a moment and soak 
this up. Each face is first rotated towards its position, then 
translated outward in a separate vector.&lt;br /&gt;


 We have a working cube, but we’re not done yet.&lt;br /&gt;


 &lt;h4&gt;
Returning to the Z-axis origin&lt;/h4&gt;
For the sake of our users, our 3-D transforms should not distort the
 interface when the active panel is at its resting position. But once we
 start pushing elements off their Z-axis origin, distortion is 
inevitable. &lt;br /&gt;


 In order to keep 3-D transforms snappy, Safari composites the 
element, then applies the transform. Consequently, anti-aliasing on text
 will remain whatever it was &lt;em&gt;before&lt;/em&gt; the transform was applied. When transformed forward in 3-D space, significant pixelation can occur. &lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/transforms-02-pixelation.html&quot;&gt;&lt;strong&gt;See Example: Transforms 2&lt;/strong&gt;&lt;/a&gt;.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/transforms-02-pixelation.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;Using 3D transforms can pixelate text&quot; src=&quot;http://media.24ways.org/2010/desandro/pixelation01.png&quot; /&gt;&lt;/div&gt;
&lt;/a&gt;

 Looking back at the &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/perspective-03.html&quot;&gt;Perspective 3 demo&lt;/a&gt;, note that no matter how small the perspective value is, or wherever the &lt;code&gt;transform-origin&lt;/code&gt; may be, the panel number 1 always returns to its original position, as if all those funky 3-D transforms didn’t even matter.&lt;br /&gt;


 To resolve the distortion and restore pixel perfection to our &lt;code&gt;#cube&lt;/code&gt;, we can push the 3-D object back, so that the front face will be positioned back to the Z-axis origin.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#cube { -webkit-transform: translateZ(-100px); }
&lt;/code&gt;&lt;/pre&gt;
&lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/cube-01-steps.html&quot;&gt;&lt;strong&gt;See Example: Cube 1&lt;/strong&gt;&lt;/a&gt;.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/cube-01-steps.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;CSS 3D cube object&quot; src=&quot;http://media.24ways.org/2010/desandro/cube01.png&quot; /&gt;&lt;span class=&quot;caption&quot;&gt;Restoring the front face to the original position on the Z-axis&lt;/span&gt;&lt;/div&gt;
&lt;/a&gt;

 &lt;h4&gt;
Rotating the cube&lt;/h4&gt;
To expose any face of the cube, we’ll need a style that rotates the 
cube to expose any face. The transform values are the opposite of those 
for the corresponding face. We toggle the necessary class on the &lt;code&gt;#box&lt;/code&gt; to apply the appropriate transform.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#cube.show-front { -webkit-transform: translateZ(-100px) rotateY(0deg); }
#cube.show-back { -webkit-transform: translateZ(-100px) rotateX(-180deg); }
#cube.show-right { -webkit-transform: translateZ(-100px) rotateY(-90deg); }
#cube.show-left { -webkit-transform: translateZ(-100px) rotateY(90deg); }
#cube.show-top { -webkit-transform: translateZ(-100px) rotateX(-90deg); }
#cube.show-bottom { -webkit-transform: translateZ(-100px) rotateX(90deg); }
&lt;/code&gt;&lt;/pre&gt;
Notice how the order of the transform functions has reversed. First, we push the object back with &lt;code&gt;translateZ&lt;/code&gt;, then we rotate it.&lt;br /&gt;


 Finishing up, we can add a &lt;code&gt;transition&lt;/code&gt; to animate the rotation between states. &lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#cube { -webkit-transition: -webkit-transform 1s; }
&lt;/code&gt;&lt;/pre&gt;
&lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/cube-02-show-sides.html&quot;&gt;&lt;strong&gt;See Example: Cube 2&lt;/strong&gt;&lt;/a&gt;.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/cube-02-show-sides.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;CSS 3D cube object changing sides&quot; src=&quot;http://media.24ways.org/2010/desandro/cube02.png&quot; /&gt;&lt;span class=&quot;caption&quot;&gt;Rotating the cube with a &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; &lt;code&gt;transition&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/a&gt;

 &lt;h3&gt;
Rectangular prism&lt;/h3&gt;
Cubes are easy enough to generate, as we only have to worry about 
one measurement. But how would we handle a non-regular rectangular 
prism? Let’s try to make one that’s 300 pixels wide, 200 pixels high, 
and 100 pixels deep. &lt;br /&gt;


 The markup remains the same as the &lt;code&gt;#cube&lt;/code&gt;, but we’ll switch the &lt;code&gt;cube&lt;/code&gt; id for &lt;code&gt;#box&lt;/code&gt;. The container styles remain mostly the same:&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;.container {
  width: 300px;
  height: 200px;
  position: relative;
  -webkit-perspective: 1000;
}
#box {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transform-style: preserve-3d;
}
&lt;/code&gt;&lt;/pre&gt;
Now to position the faces. Each set of faces will need their own 
sizes. The smaller faces (left, right, top and bottom) need to be 
positioned in the centre of the container, where they can be easily 
rotated and then shifted outward. The thinner left and right faces get 
positioned &lt;code&gt;left: 100px&lt;/code&gt; ((300 − 100) ÷ 2), The stouter top and bottom faces get positioned &lt;code&gt;top: 50px&lt;/code&gt; ((200 − 100) ÷ 2).&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#box figure {
  display: block;
  position: absolute;
  border: 2px solid black;
}
#box .front,
#box .back {
  width: 296px;
  height: 196px;
}
#box .right,
#box .left {
  width: 96px;
  height: 196px;
  left: 100px;
}
#box .top,
#box .bottom {
  width: 296px;
  height: 96px;
  top: 50px;
}
&lt;/code&gt;&lt;/pre&gt;
The rotate values can all remain the same as the cube example, but 
for this rectangular prism, the translate values do differ. The front 
and back faces are each shifted out 50 pixels since the &lt;code&gt;#box&lt;/code&gt;
 is 100 pixels deep. The translate value for the left and right faces is
 150 pixels for their 300 pixels width. Top and bottom panels take 100 
pixels for their 200 pixels height:&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#box .front { -webkit-transform: rotateY(0deg) translateZ(50px); }
#box .back { -webkit-transform: rotateX(180deg) translateZ(50px); }
#box .right { -webkit-transform: rotateY(90deg) translateZ(150px); }
#box .left { -webkit-transform: rotateY(-90deg) translateZ(150px); }
#box .top { -webkit-transform: rotateX(90deg) translateZ(100px); }
#box .bottom { -webkit-transform: rotateX(-90deg) translateZ(100px); }
&lt;/code&gt;&lt;/pre&gt;
&lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/box-01-steps.html&quot;&gt;&lt;strong&gt;See Example: Box 1&lt;/strong&gt;&lt;/a&gt;.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/box-01-steps.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;3D CSS box object&quot; src=&quot;http://media.24ways.org/2010/desandro/box01.png&quot; /&gt;&lt;/div&gt;
&lt;/a&gt;

 Just like the cube example, to expose a face, the &lt;code&gt;#box&lt;/code&gt; needs to have a style to reverse that face’s transform. Both the &lt;code&gt;translateZ&lt;/code&gt; and &lt;code&gt;rotate&lt;/code&gt; values are the opposites of the corresponding face.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#box.show-front { -webkit-transform: translateZ(-50px) rotateY(0deg); }
#box.show-back { -webkit-transform: translateZ(-50px) rotateX(-180deg); }
#box.show-right { -webkit-transform: translateZ(-150px) rotateY(-90deg); }
#box.show-left { -webkit-transform: translateZ(-150px) rotateY(90deg); }
#box.show-top { -webkit-transform: translateZ(-100px) rotateX(-90deg); }
#box.show-bottom { -webkit-transform: translateZ(-100px) rotateX(90deg); }
&lt;/code&gt;&lt;/pre&gt;
&lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/box-02-show-sides.html&quot;&gt;&lt;strong&gt;See Example: Box 2&lt;/strong&gt;&lt;/a&gt;.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/box-02-show-sides.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;3D CSS box object rotating&quot; src=&quot;http://media.24ways.org/2010/desandro/box02.png&quot; /&gt;&lt;span class=&quot;caption&quot;&gt;Rotating the rectangular box with a &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; &lt;code&gt;transition&lt;/code&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/a&gt;

 &lt;h3&gt;
Carousel&lt;/h3&gt;
Front-end developers have a myriad of choices when it comes to 
content carousels. Now that we have 3-D capabilities in our browsers, 
why not take a shot at creating an actual 3-D carousel?&lt;br /&gt;


 The markup for this demo takes the same form as the box, cube and 
card. Let’s make it interesting and have a carousel with nine panels.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&quot;container&quot;&amp;gt;
  &amp;lt;div id=&quot;carousel&quot;&amp;gt;
    &amp;lt;figure&amp;gt;1&amp;lt;/figure&amp;gt;
    &amp;lt;figure&amp;gt;2&amp;lt;/figure&amp;gt;
    &amp;lt;figure&amp;gt;3&amp;lt;/figure&amp;gt;
    &amp;lt;figure&amp;gt;4&amp;lt;/figure&amp;gt;
    &amp;lt;figure&amp;gt;5&amp;lt;/figure&amp;gt;
    &amp;lt;figure&amp;gt;6&amp;lt;/figure&amp;gt;
    &amp;lt;figure&amp;gt;7&amp;lt;/figure&amp;gt;
    &amp;lt;figure&amp;gt;8&amp;lt;/figure&amp;gt;
    &amp;lt;figure&amp;gt;9&amp;lt;/figure&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
Now, apply basic layout styles. Let’s give each panel of the &lt;code&gt;#carousel&lt;/code&gt; 20 pixel gaps between one another, done here with &lt;code&gt;left: 10px;&lt;/code&gt; and &lt;code&gt;top: 10px;&lt;/code&gt;. The effective width of each panel is 210 pixels.&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;.container {
  width: 210px;
  height: 140px;
  position: relative;
  -webkit-perspective: 1000;
}
#carousel {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-transform-style: preserve-3d;
}
#carousel figure {
  display: block;
  position: absolute;
  width: 186px;
  height: 116px;
  left: 10px;
  top: 10px;
  border: 2px solid black;
}
&lt;/code&gt;&lt;/pre&gt;
Next up: rotating the faces. This &lt;code&gt;#carousel&lt;/code&gt; has nine 
panels. If each panel gets an equal distribution on the carousel, each 
panel would be rotated forty degrees from its neighbour (360 ÷ 9).&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#carousel figure:nth-child(1) { -webkit-transform: rotateY(0deg); }
#carousel figure:nth-child(2) { -webkit-transform: rotateY(40deg); }
#carousel figure:nth-child(3) { -webkit-transform: rotateY(80deg); }
#carousel figure:nth-child(4) { -webkit-transform: rotateY(120deg); }
#carousel figure:nth-child(5) { -webkit-transform: rotateY(160deg); }
#carousel figure:nth-child(6) { -webkit-transform: rotateY(200deg); }
#carousel figure:nth-child(7) { -webkit-transform: rotateY(240deg); }
#carousel figure:nth-child(8) { -webkit-transform: rotateY(280deg); }
#carousel figure:nth-child(9) { -webkit-transform: rotateY(320deg); }
&lt;/code&gt;&lt;/pre&gt;
Now, the outward shift. Back when we were creating the cube and box, the &lt;code&gt;translate&lt;/code&gt;
 value was simple to calculate, as it was equal to one half the width, 
height or depth of the object. With this carousel, there is no size we 
can automatically use as a reference. We’ll have to calculate the 
distance of the shift by other means.&lt;br /&gt;


 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;Geometric diagram of carousel&quot; src=&quot;http://media.24ways.org/2010/desandro/diagram.png&quot; /&gt;&lt;/div&gt;
Drawing a diagram of the carousel, we can see that we know only two 
things: the width of each panel is 210 pixels; and the each panel is 
rotated forty degrees from the next. If we split one of these segments 
down its centre, we get a right-angled triangle, perfect for some 
trigonometry.&lt;br /&gt;


 We can determine the length of &lt;em&gt;r&lt;/em&gt; in this diagram with a basic tangent equation:&lt;br /&gt;


 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;Trigonometric calculation&quot; src=&quot;http://media.24ways.org/2010/desandro/calc.png&quot; /&gt;&lt;/div&gt;
There you have it: the panels need to be translated 288 pixels in 3-D space. &lt;br /&gt;


&lt;pre&gt;&lt;code&gt;#carousel figure:nth-child(1) { -webkit-transform: rotateY(0deg) translateZ(288px); }
#carousel figure:nth-child(2) { -webkit-transform: rotateY(40deg) translateZ(288px); }
#carousel figure:nth-child(3) { -webkit-transform: rotateY(80deg) translateZ(288px); }
#carousel figure:nth-child(4) { -webkit-transform: rotateY(120deg) translateZ(288px); }
#carousel figure:nth-child(5) { -webkit-transform: rotateY(160deg) translateZ(288px); }
#carousel figure:nth-child(6) { -webkit-transform: rotateY(200deg) translateZ(288px); }
#carousel figure:nth-child(7) { -webkit-transform: rotateY(240deg) translateZ(288px); }
#carousel figure:nth-child(8) { -webkit-transform: rotateY(280deg) translateZ(288px); }
#carousel figure:nth-child(9) { -webkit-transform: rotateY(320deg) translateZ(288px); }
&lt;/code&gt;&lt;/pre&gt;
If we decide to change the width of the panel or the number of 
panels, we only need to plug in those two variables into our equation to
 get the appropriate &lt;code&gt;translateZ&lt;/code&gt; value. In JavaScript terms, that equation would be:&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;var tz = Math.round( ( panelSize / 2 ) / 
  Math.tan( ( ( Math.PI * 2 ) / numberOfPanels ) / 2 ) );
// or simplified to
var tz = Math.round( ( panelSize / 2 ) / 
  Math.tan( Math.PI / numberOfPanels ) );
&lt;/code&gt;&lt;/pre&gt;
Just like our previous 3-D objects, to show any one panel we need 
only apply the reverse transform on the carousel. Here’s the style to 
show the fifth panel:&lt;br /&gt;


&lt;pre&gt;&lt;code&gt;-webkit-transform: translateZ(-288px) rotateY(-160deg);
&lt;/code&gt;&lt;/pre&gt;
&lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/carousel-01.html&quot;&gt;&lt;strong&gt;See Example: Carousel 1&lt;/strong&gt;&lt;/a&gt;.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/carousel-01.html&quot;&gt;

 &lt;div class=&quot;image&quot;&gt;
&lt;img alt=&quot;3-D CSS carousel&quot; src=&quot;http://media.24ways.org/2010/desandro/carousel01.png&quot; /&gt;&lt;/div&gt;
&lt;/a&gt;

 By now, you probably have two thoughts: &lt;br /&gt;


 &lt;ol&gt;
&lt;li&gt;Rewriting transform styles for each panel looks tedious.&lt;/li&gt;
&lt;li&gt;Why bother doing high school maths? Aren’t robots supposed to be doing all this work for us?&lt;/li&gt;
&lt;/ol&gt;
And you’re absolutely right. The repetitive nature of 3-D objects 
lends itself to scripting. We can offload all the monotonous transform 
styles to our dynamic script, which, if done correctly, will be more 
flexible than the hard-coded version.&lt;br /&gt;


 &lt;a href=&quot;http://desandro.github.com/3dtransforms/examples/carousel-02-dynamic.html&quot;&gt;&lt;strong&gt;See Example: Carousel 2&lt;/strong&gt;&lt;/a&gt;.&lt;br /&gt;


 &lt;h3&gt;
Conclusion&lt;/h3&gt;
3-D transforms change the way we think about the blank canvas of web
 design. Better yet, they change the canvas itself, trading in the flat 
surface for voluminous depth.&lt;br /&gt;


 My hope is that you took at least one peak at a demo and were intrigued. We web designers, who have rejoiced for &lt;code&gt;border-radius&lt;/code&gt;, &lt;code&gt;box-shadow&lt;/code&gt;
 and background gradients, now have an incredible tool at our disposal 
in 3-D transforms. They deserve just the same enthusiasm, research and 
experimentation we have seen on other CSS3 features. Now is the perfect 
time to take the plunge and start thinking about how to use three 
dimensions to elevate our craft. I’m breathless waiting for what’s to 
come. &lt;br /&gt;


 See you on the flip side.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/5938836128206836778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/5938836128206836778' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/5938836128206836778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/5938836128206836778'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/02/introduction-to-css-3-d-transforms.html' title='An Introduction to CSS 3-D Transforms'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-7938800898521742779</id><published>2012-02-12T03:47:00.001-08:00</published><updated>2012-02-12T03:47:13.837-08:00</updated><title type='text'>New form features in HTML5</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2&gt;
Introduction&lt;/h2&gt;
HTML5 includes many new features to make web forms a lot easier to 
write, and a lot more powerful and consistent across the Web. This 
article gives a brief overview of some of the new form controls and 
functionalities that have been introduced.&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#badform&quot;&gt;Bad form?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#formexample&quot;&gt;Introducing our example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#newcontrols&quot;&gt;New form controls&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#input-number&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;number&quot;&amp;gt;&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#input-range&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;range&quot;&amp;gt;&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#input-datetime&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;date&quot;&amp;gt;&lt;/code&gt; and other date/time controls&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#input-color&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;color&quot;&amp;gt;&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#input-search&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;search&quot;&amp;gt;&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#datalist&quot;&gt;&lt;code&gt;&amp;lt;datalist&amp;gt;&lt;/code&gt; element and &lt;code&gt;list&lt;/code&gt; attribute&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#input-tel-email-url&quot;&gt;&lt;code&gt;&amp;lt;input type=&quot;tel&quot;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;input type=&quot;email&quot;&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;input type=&quot;url&quot;&amp;gt;&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#newattributes&quot;&gt;New attributes&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#placeholder&quot;&gt;&lt;code&gt;placeholder&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#autofocus&quot;&gt;&lt;code&gt;autofocus&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#min-max&quot;&gt;&lt;code&gt;min&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#step&quot;&gt;&lt;code&gt;step&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#newoutput&quot;&gt;New output mechanisms&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#output&quot;&gt;&lt;code&gt;&amp;lt;output&amp;gt;&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#progress-meter&quot;&gt;&lt;code&gt;&amp;lt;progress&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;meter&amp;gt;&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#validation&quot;&gt;Validation&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#required&quot;&gt;&lt;code&gt;required&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#type-pattern&quot;&gt;&lt;code&gt;type&lt;/code&gt; and &lt;code&gt;pattern&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#stylingcss3&quot;&gt;Styling with CSS3&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/#crossbrowser&quot;&gt;Cross browser?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;badform&quot;&gt;
Bad form?&lt;/h2&gt;
Let&#39;s face it – HTML forms have always been a pain. They are not much
 fun to mark up and they can be fiddly to style – especially if you want
 them to be consistent cross-browser and fit in with the overall look 
and feel of your site. And they can be frustrating for your end users to
 fill out, even if you create them with care and consideration to make 
them as usable and accessible as possible. Creating a good form is more 
about damage limitation than pleasurable user experiences.&lt;br /&gt;


Back when HTML 4.01 became a stable  recommendation,  the web was a 
mostly static place. Yes, there was the odd comment  form or guest book 
script, but generally web sites were there for  visitors to simply read.
 Since then, the web has evolved. For many  people, the browser has 
already become a window into a world of  complex, web-based applications
 that try to bring an almost  desktop-like experience.&lt;br /&gt;

&lt;img alt=&quot;Some complicated non-native form controls, faked with JavaScript&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig1.png&quot; /&gt;&lt;br /&gt;

&lt;div class=&quot;comment&quot;&gt;
Figure 1: Some complicated non-native form controls, faked with JavaScript.&lt;/div&gt;
To fill the need for the more sophisticated controls required for 
such applications, developers have been taking advantage of JavaScript 
libraries and frameworks (such as jQueryUI or YUI). These solutions have
 certainly matured over the years, bringing rich functionality to web 
pages and even starting to incorporate screenreader support through 
bridging technologies like WAI-ARIA. But essentially, they&#39;re a 
workaround to compensate for the limited form controls available in 
HTML. They “fake” the more complex widgets (such as date pickers and 
sliders) by layering additional (not always semantic) markup and a slew 
of JavaScript on top of pages.&lt;br /&gt;

HTML5 aims to standardise some of the  most common rich form 
controls, making them render natively in the  browser and obviating the 
need for these script-heavy workarounds.&lt;br /&gt;


&lt;h2 id=&quot;formexample&quot;&gt;
Introducing our example&lt;/h2&gt;
To illustrate some of the new features, this article comes with a &lt;a href=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/html5-forms-example.html&quot;&gt;basic HTML5 forms example&lt;/a&gt;.
 It&#39;s not meant to represent a &quot;real&quot; form (as you&#39;d be hard-pressed to 
find a situation where you need all the new features in a single form), 
but it should give you an idea of how the various new aspects look and 
behave.&lt;br /&gt;

&lt;div class=&quot;note&quot;&gt;
Note: the look and feel of the new form controls and 
validation messages differs from brower to browser, so styling your 
forms to look reasonably consistent across browsers will still need 
careful consideration.&lt;/div&gt;
&lt;h2 id=&quot;newcontrols&quot;&gt;
New form controls&lt;/h2&gt;
As forms are the main tool for data input in Web applications, and 
the data we want to collect has become more complex, it has been 
necessary to create an input element with more capabilities, to collect 
this data with more semantics and better definition, and allow for 
easier, more effective error mnagement and validation.&lt;br /&gt;


&lt;h3 id=&quot;input-number&quot;&gt;
&lt;code&gt;&amp;lt;input type=&quot;number&quot;&amp;gt;&lt;/code&gt;&lt;/h3&gt;
The first new input type we&#39;ll discuss is the number type:&lt;br /&gt;


&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;number&quot;&lt;/span&gt; … &amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
This creates a special kind of input field for number entry – in most
 supporting browsers this appears as a text entry field with a spinner 
control, which allows you to increment and decrement its  value.&lt;br /&gt;


&lt;img alt=&quot;A number input type&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig2.png&quot; /&gt;&lt;br /&gt;

&lt;div class=&quot;comment&quot;&gt;
Figure 2: A &lt;code&gt;number&lt;/code&gt; input type.&lt;/div&gt;
&lt;h3 id=&quot;input-range&quot;&gt;
&lt;code&gt;&amp;lt;input type=&quot;range&quot;&amp;gt;&lt;/code&gt;&lt;/h3&gt;
Creating a slider control to allow you to choose between a range of 
values used to be a complicated, semantically dubious proposition, but 
with HTML5 it is easy — you just use the &lt;code&gt;range&lt;/code&gt; input type:&lt;br /&gt;


&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;range&quot;&lt;/span&gt; … &amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;img alt=&quot;A range input type&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig3.png&quot; /&gt;&lt;br /&gt;

&lt;div class=&quot;comment&quot;&gt;
Figure 3: A &lt;code&gt;range&lt;/code&gt; input type.&lt;/div&gt;
Note that, by default, this input does not generally show the 
currently selected value, or even the range of values it covers. Authors
 will need to provide these through other means – for instance, to 
display the current value, we could us an output element together with 
some JavaScript to update its display whenever the user has interacted 
with the form:&lt;br /&gt;

&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;output&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;onforminput&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;value=weight.value&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;output&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;input-datetime&quot;&gt;
&lt;code&gt;&amp;lt;input type=&quot;date&quot;&amp;gt;&lt;/code&gt; and other date/time controls&lt;/h3&gt;
HTML5 has a number of different input types for creating complicated 
date/time pickers, for example the kind of date picker you see featured 
on pretty much every flight/train booking site out there. These used to 
be created using unsemantic kludges, so it is great that we now have 
standardized easy ways to do this. For example:&lt;br /&gt;

   
&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;date&quot;&lt;/span&gt; … &amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;time&quot;&lt;/span&gt; … &amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
Respectively, these create a fully functioning date picker, and a 
text input containing a separator for hours, minutes and seconds 
(depending on the &lt;code&gt;step&lt;/code&gt; attribute specified) that only allows you to input a time value.&lt;br /&gt;

   
&lt;img alt=&quot;date and time input types&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig4.png&quot; /&gt;&lt;br /&gt;

&lt;div class=&quot;comment&quot;&gt;
Figure 4: &lt;code&gt;date&lt;/code&gt; and &lt;code&gt;time&lt;/code&gt; input types.&lt;/div&gt;
But it doesn&#39;t end here — there are a number of other related input types available:&lt;br /&gt;


&lt;ul&gt;
&lt;li&gt;&lt;code&gt;datetime&lt;/code&gt;: combines the functionality of two we have looked at above, allowing you to choose a date and a time&lt;/li&gt;
&lt;li&gt;&lt;code&gt;month&lt;/code&gt;: allows you to choose a month, stored internally 
as a number between 1-12, although different browsers may provide you 
with more elaborate choosing mechanisms, like a scrolling list of the 
month names&lt;/li&gt;
&lt;li&gt;&lt;code&gt;week&lt;/code&gt;: allows you to choose a week, stored internally in
 the format 2010-W37 (week 37 of the year 2010), and chosen using a 
similar datepicker to the ones we have seen already&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;input-color&quot;&gt;
&lt;code&gt;&amp;lt;input type=&quot;color&quot;&amp;gt;&lt;/code&gt;&lt;/h3&gt;
This input type brings up a color picker. Opera&#39;s implementation 
allows the user to pick from a selection of colors, enter hexadecimal 
values directly in a text field, or to invoke the OS&#39;s native color 
picker.&lt;br /&gt;


&lt;img alt=&quot;a color input, and the native color pickers on Windows and OS X&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig5.png&quot; /&gt;&lt;br /&gt;

&lt;div class=&quot;comment&quot;&gt;
Figure 5: a &lt;code&gt;color&lt;/code&gt; input, and the native color pickers on Windows and OS X.&lt;/div&gt;
&lt;h3 id=&quot;input-search&quot;&gt;
&lt;code&gt;&amp;lt;input type=&quot;search&quot;&amp;gt;&lt;/code&gt;&lt;/h3&gt;
The &lt;code&gt;search&lt;/code&gt; input type is arguably nothing more than a 
differently-styled text input. Browsers are meant to style these inputs 
the same way as any OS-specific search functionality. Beyond this purely
 aesthetic consideration, though, it&#39;s still important to note that 
marking up search fields explicitly opens up the possibility for 
browsers, assistive technologies or automated crawlers to do something 
clever with these inputs in the future – for instance, a browser could 
conceivably offer the user a choice to automatically create a custom 
search for a specific site.&lt;br /&gt;


&lt;img alt=&quot;A search input as it appears in Opera on OS X&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig6.png&quot; /&gt;&lt;br /&gt;

&lt;div class=&quot;comment&quot;&gt;
Figure 6: A &lt;code&gt;search&lt;/code&gt; input as it appears in Opera on OS X.&lt;/div&gt;
&lt;h3 id=&quot;datalist&quot;&gt;
&lt;code&gt;&amp;lt;datalist&amp;gt;&lt;/code&gt; element and &lt;code&gt;list&lt;/code&gt; attribute&lt;/h3&gt;
Up until now we have been used to using &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt;
 elements to create dropdown lists of options for our users to choose 
from. But what if we wanted to create a list that allowed users to 
choose from a list of suggested options, as well as being able to type 
in their own? That required fiddly scripting – but now you can simply 
use the &lt;code&gt;list&lt;/code&gt; attribute to connect an ordinary input to a list of options, defined inside a &lt;code&gt;&amp;lt;datalist&amp;gt;&lt;/code&gt; element.&lt;br /&gt;

   
&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;strong&gt;&lt;span class=&quot;attribute&quot;&gt;list&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;mydata&quot;&lt;/span&gt;&lt;/strong&gt; … &amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;datalist&lt;/span&gt; &lt;strong&gt;&lt;span class=&quot;attribute&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;mydata&quot;&lt;/span&gt;&lt;/strong&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;option&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;label&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;Mr&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;value&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;Mister&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;option&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;label&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;Mrs&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;value&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;Mistress&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;option&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;label&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;Ms&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;value&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;Miss&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;datalist&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;img alt=&quot;Creating an input element with preset options using datalist&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig7.png&quot; /&gt;&lt;br /&gt;

&lt;div class=&quot;comment&quot;&gt;
Figure 7: Creating an input element with suggestions using &lt;code&gt;datalist&lt;/code&gt;.&lt;/div&gt;
&lt;h3 id=&quot;input-tel-email-url&quot;&gt;
&lt;code&gt;&amp;lt;input type=&quot;tel&quot;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;input type=&quot;email&quot;&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;input type=&quot;url&quot;&amp;gt;&lt;/code&gt;&lt;/h3&gt;
As their names imply, these new input types relate to telephone 
numbers, email addresses or URLs. Browsers will render these as normal 
text entry inputs, but explicitly stating what kind of text we&#39;re 
expecting in these fields plays an important role in client-side form 
validation. Additionally, on certain mobile devices the browser will 
switch from its  regular text entry on-screen keyboard to the more 
context-relevant  variants. Again, it&#39;s conceivable that in the future 
browsers will take further advantage of these explicitly marked-up 
inputs to offer additional functionality, such as autocompleting email 
addresses and telephone numbers based on the user&#39;s contacts list or 
address book.&lt;br /&gt;


&lt;h2 id=&quot;newattributes&quot;&gt;
New attributes&lt;/h2&gt;
In addition to explicit new input types, HTML5 defines a series of 
new attributes for form controls that help simplify some common tasks 
and further specify the expected values for certain entry fields.&lt;br /&gt;


&lt;h3 id=&quot;placeholder&quot;&gt;
&lt;code&gt;placeholder&lt;/code&gt;&lt;/h3&gt;
A common usability trick in web forms is to have placeholder content 
in text entry fields – for instance, to give more information about the 
expected type of information we want the user to enter – which 
disappears when the form control gets focus. While this used to require 
some JavaScript (clearing the contents of the form field on focus and 
resetting it to the default text if the user left the field without 
entering anything), we can now simply use the &lt;code&gt;placeholder&lt;/code&gt; attribute:&lt;br /&gt;


&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;text&quot;&lt;/span&gt;… &lt;strong&gt;&lt;span class=&quot;attribute&quot;&gt;placeholder&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;John Doe&quot;&lt;/span&gt;&lt;/strong&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;img alt=&quot;A text input with placeholder text&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig8.png&quot; /&gt;&lt;br /&gt;

&lt;div class=&quot;comment&quot;&gt;
Figure 8: A text input with &lt;code&gt;placeholder&lt;/code&gt; text.&lt;/div&gt;
&lt;h3 id=&quot;autofocus&quot;&gt;
&lt;code&gt;autofocus&lt;/code&gt;&lt;/h3&gt;
Another common feature that previously had to rely on scripting is 
having a form field automatically focused when a page is loaded. This 
can now be achieved with the &lt;code&gt;autofocus&lt;/code&gt; attribute:&lt;br /&gt;


&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;strong&gt;&lt;span class=&quot;attribute&quot;&gt;autofocus&lt;/span&gt;&lt;/strong&gt; … &amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
Keep in mind that you shouldn&#39;t have more than one &lt;code&gt;autofocus&lt;/code&gt;
 form control on a single page. You should also use this sort of 
functionality with caution, in situations where a form represents the 
main area of interest in a page. A search page is a good example – 
provided that there isn&#39;t a lot of content and explanatory text, it 
makes sense to set the focus automatically to the text input of the 
search form.&lt;br /&gt;


&lt;h3 id=&quot;min-max&quot;&gt;
&lt;code&gt;min&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;&lt;/h3&gt;
As their name suggests, this pair of attributes allows you to set a 
lower and upper bound for the values that can be entered into a 
numerical form field, for example number, range, time or date input 
types (yes, you can even use it to set upper and lower bounds for dates –
 for instance, on a travel booking form you could limit the datepicker 
to only allow the user to select future dates). For &lt;code&gt;range&lt;/code&gt; inputs, &lt;code&gt;min&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;
 are actually necessary to define what values are  returned when the 
form is submitted. The code is pretty simple and self-explanatory:&lt;br /&gt;


&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;number&quot;&lt;/span&gt; … &lt;strong&gt;&lt;span class=&quot;attribute&quot;&gt;min&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;1&quot;&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;max&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;10&quot;&lt;/span&gt;&lt;/strong&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;step&quot;&gt;
&lt;code&gt;step&lt;/code&gt;&lt;/h3&gt;
The &lt;code&gt;step&lt;/code&gt; attribute can be used with a numerical input 
value to dictate how granular the values you can input are. For example,
 you might want users to enter a particular time, but only in 30 minute 
increments. In this case, we can use the &lt;code&gt;step&lt;/code&gt; attribute, keeping in mind that for &lt;code&gt;time&lt;/code&gt; inputs the value of the attribute is in seconds:&lt;br /&gt;


&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;time&quot;&lt;/span&gt; … &lt;strong&gt;&lt;span class=&quot;attribute&quot;&gt;step&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;1800&quot;&lt;/span&gt;&lt;/strong&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;newoutput&quot;&gt;
New output mechanisms&lt;/h2&gt;
Beyond the new form controls that users can interact with, HTML5 
defines a series of new elements specifically meant to display and 
visualise information to the user.&lt;br /&gt;


&lt;h3 id=&quot;output&quot;&gt;
&lt;code&gt;&amp;lt;output&amp;gt;&lt;/code&gt;&lt;/h3&gt;
We&#39;ve already mentioned the &lt;code&gt;output&lt;/code&gt; element when talking about the &lt;code&gt;range&lt;/code&gt; input – this element serves as a way to display the &lt;q&gt;result of a calculation&lt;/q&gt;,
 or more generally to provide an explicitly identified output of a 
script (rather than simply pushing some text into in a random &lt;code&gt;span&lt;/code&gt; or &lt;code&gt;div&lt;/code&gt; with &lt;code&gt;innerHTML&lt;/code&gt;, for instance). To make it even more explicit what particular form controls the &lt;code&gt;output&lt;/code&gt; relates to, we can – in a similar way to &lt;code&gt;label&lt;/code&gt; – pass a list of &lt;code&gt;ID&lt;/code&gt;s in the element&#39;s optional &lt;code&gt;for&lt;/code&gt; attribute.&lt;br /&gt;


&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;
&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;range&quot;&lt;/span&gt; &lt;strong&gt;&lt;span class=&quot;attribute&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;rangeexample&quot;&lt;/span&gt;&lt;/strong&gt; … &amp;gt;&lt;/span&gt;
&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;output&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;onforminput&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;value=rangeexample.value&quot;&lt;/span&gt; &lt;strong&gt;&lt;span class=&quot;attribute&quot;&gt;for&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;rangeexample&quot;&lt;/span&gt;&lt;/strong&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;/&lt;span class=&quot;title&quot;&gt;output&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;progress-meter&quot;&gt;
&lt;code&gt;&amp;lt;progress&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;meter&amp;gt;&lt;/code&gt;&lt;/h3&gt;
These two new elements are very similar, both resulting in a 
gauge/bar being presented to the user. Their distinction is in their 
intended purpose. As the name suggests, &lt;code&gt;progress&lt;/code&gt; is meant 
to represent a progress bar, to indicate the percentage of completion of
 a particular task, while meter is a more generic indicator of a scalar 
measurement or fractional value.&lt;br /&gt;


&lt;img alt=&quot;A progress indicator bar&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig9.png&quot; /&gt;&lt;br /&gt;

&lt;div class=&quot;comment&quot;&gt;
Figure 9: A progress indicator bar.&lt;/div&gt;
&lt;h2 id=&quot;validation&quot;&gt;
Validation&lt;/h2&gt;
Form validation is very important on both client- and server-side, to
 help legitimate users avoid and correct mistakes, and to stop malicious
 users submitting data that could cause damage to our application. As 
browsers can now get an idea of what type of values are expected from 
the various form controls (be it their &lt;code&gt;type&lt;/code&gt;, or any 
upper/lower bounds set on numerical values, dates and times), they can 
also offer native form validation – another tedious task that, up to 
now, required authors to write reams of JavaScript or use some 
ready-made validation script/library.&lt;br /&gt;


&lt;div class=&quot;note&quot;&gt;
Note: for form controls to be validated, they need to have a &lt;code&gt;name&lt;/code&gt; attribute, as without it they wouldn&#39;t be submitted as part of the form anyway.&lt;/div&gt;
&lt;h3 id=&quot;required&quot;&gt;
&lt;code&gt;required&lt;/code&gt;&lt;/h3&gt;
One of the most common aspects of form validation is the enforcement 
of required fields – not allowing a form to be submitted until certain 
pieces of information have been entered. This can now simply be achieved
 by adding the &lt;code&gt;required&lt;/code&gt; attribute to an &lt;code&gt;input&lt;/code&gt;, &lt;code&gt;select&lt;/code&gt; or &lt;code&gt;textarea&lt;/code&gt; element.&lt;br /&gt;


&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;text&quot;&lt;/span&gt; … &lt;strong&gt;&lt;span class=&quot;attribute&quot;&gt;required&lt;/span&gt;&lt;/strong&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;img alt=&quot;Opera&#39;s client-side validation in action, showing an error for a required field that was left empty&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig10.png&quot; /&gt;&lt;br /&gt;

&lt;div class=&quot;comment&quot;&gt;
Figure 10: Opera&#39;s client-side validation in action, showing an error for a required field that was left empty.&lt;/div&gt;
&lt;h3 id=&quot;type-pattern&quot;&gt;
&lt;code&gt;type&lt;/code&gt; and &lt;code&gt;pattern&lt;/code&gt;&lt;/h3&gt;
As we&#39;ve seen, authors can now specify the kinds of entries they 
expect from their form fields – rather than simply defining text inputs,
 authors can explicitly create inputs for things like numbers, email 
addresses and URLs. As part of their client-side validation, browsers 
can now check that what the user entered in these more specific fields 
matches the expected structure – in essence, browsers evaluate the input
 values against a built-in pattern that defines what valid entires in 
those types of inputs look like, and will warn a user when their entry 
didn&#39;t match the criteria.&lt;br /&gt;


&lt;img alt=&quot;Opera&#39;s error message for invalid email addresses in an email input&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig11.png&quot; /&gt;&lt;br /&gt;

Figure 11: Opera&#39;s error message for invalid email addresses in an &lt;code&gt;email&lt;/code&gt; input.&lt;br /&gt;


For other text entry fields that nonetheless need to follow a certain
 structure (for instance, login forms where the usernames can only 
contain a specific sequence of lowercase letters and numbers), authors 
can use the &lt;code&gt;pattern&lt;/code&gt; attribute to specify their own custom regular expression.&lt;br /&gt;

&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;span class=&quot;title&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;attribute&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;text&quot;&lt;/span&gt; … &lt;strong&gt;&lt;span class=&quot;attribute&quot;&gt;pattern&lt;/span&gt;=&lt;span class=&quot;value&quot;&gt;&quot;[a-z]{3}[0-9]{3}&quot;&lt;/span&gt;&lt;/strong&gt;&amp;gt;&lt;/span&gt;&lt;/code&gt;
&lt;/pre&gt;
&lt;h2 id=&quot;stylingcss3&quot;&gt;
Styling with CSS3&lt;/h2&gt;
In concert with HTML5&#39;s built-in form validation, the &lt;a href=&quot;http://www.w3.org/TR/css3-ui/&quot;&gt;CSS3 Basic User Interface Module&lt;/a&gt;
 defines a series of new pseudo-classes that can be used to 
differentiate required fields and to change the appearance of form 
controls dynamically based on whether or not they have been filled in 
correctly:&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:required&lt;/code&gt; and &lt;code&gt;:optional&lt;/code&gt; let us explicitly style controls based on whether or not they have a required attribute&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:valid&lt;/code&gt; and &lt;code&gt;:invalid&lt;/code&gt; will apply styles to form controls subject to client-side validation&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:in-range&lt;/code&gt; and &lt;code&gt;:out-of-range&lt;/code&gt; specifically works with controls that feature a min and/or max attribute&lt;/li&gt;
&lt;/ul&gt;
In our example form, we&#39;re only applying specific validity and range 
styles on text, email, url and number inputs when they are currently 
focused, so users would get some immediate visual feedback while 
entering information into those fields, but without affecting the 
overall look of the form in general.&lt;br /&gt;


&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;&lt;span class=&quot;tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;attr_selector&quot;&gt;[type=text]&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:focus&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:valid&lt;/span&gt;,
&lt;span class=&quot;tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;attr_selector&quot;&gt;[type=email]&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:focus&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:valid&lt;/span&gt;,
&lt;span class=&quot;tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;attr_selector&quot;&gt;[type=number]&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:focus&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:in-range&lt;/span&gt; &lt;span class=&quot;rules&quot;&gt;{ &lt;span class=&quot;rule&quot;&gt;&lt;span class=&quot;attribute&quot;&gt;outline&lt;/span&gt;:&lt;span class=&quot;value&quot;&gt; &lt;span class=&quot;number&quot;&gt;2&lt;/span&gt;px &lt;span class=&quot;number&quot;&gt;#0f0&lt;/span&gt; solid&lt;/span&gt;;&lt;/span&gt; &lt;span class=&quot;rule&quot;&gt;}&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;attr_selector&quot;&gt;[type=text]&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:focus&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:invalid&lt;/span&gt;,
&lt;span class=&quot;tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;attr_selector&quot;&gt;[type=email]&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:focus&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:invalid&lt;/span&gt;,
&lt;span class=&quot;tag&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;attr_selector&quot;&gt;[type=number]&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:focus&lt;/span&gt;&lt;span class=&quot;pseudo&quot;&gt;:out-of-range&lt;/span&gt; &lt;span class=&quot;rules&quot;&gt;{ &lt;span class=&quot;rule&quot;&gt;&lt;span class=&quot;attribute&quot;&gt;outline&lt;/span&gt;:&lt;span class=&quot;value&quot;&gt; &lt;span class=&quot;number&quot;&gt;2&lt;/span&gt;px &lt;span class=&quot;hexcolor&quot;&gt;#f00&lt;/span&gt; solid&lt;/span&gt;;&lt;/span&gt; &lt;span class=&quot;rule&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;img alt=&quot;:focus:valid and :focus:invalid styles being applied dynamically as an email address is entered&quot; src=&quot;http://dev.opera.com/articles/view/new-form-features-in-html5/fig12.png&quot; /&gt;&lt;br /&gt;

Figure 12: &lt;code&gt;:valid&lt;/code&gt; and &lt;code&gt;:invalid&lt;/code&gt; styles being applied dynamically as an email address is entered.&lt;br /&gt;



&lt;h2 id=&quot;crossbrowser&quot;&gt;
Cross browser?&lt;/h2&gt;
On the desktop, Opera currently has the most complete implementation
 of new input types and native client-side validation, but support is on
 the roadmap for all other major browsers as well, so it won&#39;t be long 
before we can take advantage of these new powerful tools in our 
projects. But what about older browser versions?&lt;br /&gt;

By design, browsers that don&#39;t understand the new input types (like &lt;code&gt;date&lt;/code&gt; or &lt;code&gt;number&lt;/code&gt;)
 will simply fall back to treating them as standard text inputs – not as
 user-friendly as their advanced HTML5 counterparts, but at the very 
least they allow for a form to be filled in. However, as with most of 
the new HTML5 functionalities, we can offer a nicer fallback for users 
of  browsers that aren&#39;t quite up to speed with HTML5 forms by doing 
basic JavaScript-based feature-detection and, only if needed, proceed to
 load external JavaScript libraries to “fake” the support for more 
complex form control widgets and validation. This way, we can code for 
the future, while not alienating any of our users.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/7938800898521742779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/7938800898521742779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7938800898521742779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7938800898521742779'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/02/new-form-features-in-html5.html' title='New form features in HTML5'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-9222185328229076774</id><published>2012-01-21T10:04:00.000-08:00</published><updated>2012-01-21T10:04:14.984-08:00</updated><title type='text'>Part1: Introducing Android 4.0 - Simple, Beautiful, Useful</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1&gt;

          Introducing Android 4.0
        &lt;/h1&gt;
Android 4.0 (Ice Cream Sandwich) is the latest version of the Android platform for
          phones, tablets, and more. It builds on the things people love most about Android — easy
          multitasking, rich notifications, customizable home screens, resizable widgets, and deep
          interactivity — and adds powerful new ways of communicating and sharing.
        &lt;br /&gt;

        &lt;h2 id=&quot;ui&quot;&gt;

          Simple, Beautiful, Useful
        &lt;/h2&gt;
&lt;h3&gt;

          Refined, evolved UI
        &lt;/h3&gt;
Focused on bringing the power of Android to the surface, Android 4.0 makes common actions
          more visible and lets you navigate with simple, intuitive gestures. Refined animations
          and feedback throughout the system make interactions engaging and interesting. An
          entirely new typeface optimized for high-resolution screens improves readability and
          brings a polished, modern feel to the user interface.
        &lt;br /&gt;

        
          Virtual buttons in the System Bar let you navigate instantly to Back, Home, and Recent
          Apps. The System Bar and virtual buttons are present across all apps, but can be dimmed
          by applications for full-screen viewing. You can access each application&#39;s contextual
          options in the Action Bar, displayed at the top (and sometimes also at the bottom) of the
          screen.
        &lt;br /&gt;

        
          Multitasking is a key strength of Android and it&#39;s made even easier and more visual on
          Android 4.0. The Recent Apps button lets you jump instantly from one task to another
          using the list in the System Bar. The list pops up to show thumbnail images of apps used
          recently — tapping a thumbnail switches to the app.
        &lt;br /&gt;

        &lt;div class=&quot;thumbs left single&quot;&gt;

          &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/tasks-sm.png&quot; /&gt;
          &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

            The Recent Apps list makes multitasking simple.
          &lt;/div&gt;
&lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/camera-lock-sm.png&quot; /&gt;
          &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

            Jump to the camera or see notifications without unlocking.
          &lt;/div&gt;
&lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/contact-call-sm.png&quot; /&gt;
          &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

            For incoming calls, you can respond instantly by text.
          &lt;/div&gt;
&lt;/div&gt;
Rich and interactive notifications let you keep in constant touch with incoming messages,
          play music tracks, see real-time updates from apps, and much more. On smaller-screen
          devices, notifications appear at the top of the screen, while on larger-screen devices
          they appear in the System Bar.
        &lt;br /&gt;

        &lt;h3&gt;

          Home screen folders and favorites tray
        &lt;/h3&gt;
New home screen folders offer a new way for you to group your apps and shortcuts
          logically, just by dragging one onto another. Also, in All Apps launcher, you can now
          simply drag an app to get information about it or immediately uninstall it, or disable a
          pre-installed app.
        &lt;br /&gt;

        &lt;div class=&quot;thumbs double right&quot;&gt;

          &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/all_apps-sm.png&quot; /&gt; &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/calendar-widget-sm.png&quot; /&gt;
          &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

            The All Apps launcher (left) and resizable widgets (right) give you apps and rich
            content from the home screen.
          &lt;/div&gt;
&lt;/div&gt;
On smaller-screen devices, the home screen now includes a customizable favorites tray
          visible from all home screens. You can drag apps, shortcuts, folders, and other priority
          items in or out of the favorites tray for instant access from any home screen.
        &lt;br /&gt;

        &lt;h3&gt;

          Resizable widgets
        &lt;/h3&gt;
Home screens in Android 4.0 are designed to be content-rich and customizable. You can do
          much more than add shortcuts — you can embed live application content directly through
          interactive widgets. Widgets let you check email, flip through a calendar, play music,
          check social streams, and more — right from the home screen, without having to launch
          apps. Widgets are resizable, so you can expand them to show more content or shrink them
          to save space.
        &lt;br /&gt;

        &lt;h3&gt;

          New lock screen actions
        &lt;/h3&gt;
The lock screens now let you do more without unlocking. From the slide lock screen, you
          can jump directly to the camera for a picture or pull down the notifications window to
          check for messages. When listening to music, you can even manage music tracks and see
          album art.
        &lt;br /&gt;

        &lt;h3&gt;

          Quick responses for incoming calls
        &lt;/h3&gt;
When an incoming call arrives, you can now quickly respond by text message, without
          needing to pick up the call or unlock the device. On the incoming call screen, you simply
          slide a control to see a list of text responses and then tap to send and end the call.
          You can add your own responses and manage the list from the Settings app.
        &lt;br /&gt;

        &lt;h3&gt;

          Swipe to dismiss notifications, tasks, and browser tabs
        &lt;/h3&gt;
Android 4.0 makes managing notifications, recent apps, and browser tabs even easier. You
          can now dismiss individual notifications, apps from the Recent Apps list, and browser
          tabs with a simple swipe of a finger.
        &lt;br /&gt;

        &lt;div class=&quot;right thumbs screen&quot;&gt;

          &lt;img alt=&quot;&quot; class=&quot;border&quot; src=&quot;http://www.android.com/images/ics/text-replace.png&quot; width=&quot;190&quot; /&gt;
          &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

            A spell-checker lets you find errors and fix them faster.
          &lt;/div&gt;
&lt;img alt=&quot;&quot; class=&quot;border&quot; src=&quot;http://www.android.com/images/ics/tts.png&quot; width=&quot;190&quot; /&gt;
          &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

            A powerful voice input engine lets you dictate continuously.
          &lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;

          Improved text input and spell-checking
        &lt;/h3&gt;
The soft keyboard in Android 4.0 makes text input even faster and more accurate. Error
          correction and word suggestion are improved through a new set of default dictionaries and
          more accurate heuristics for handling cases such as double-typed characters, skipped
          letters, and omitted spaces. Word suggestion is also improved and the suggestion strip is
          simplified to show only three words at a time.
        &lt;br /&gt;

        
          To fix misspelled words more easily, Android 4.0 adds a spell-checker that locates and
          underlines errors and suggests replacement words. With one tap, you can choose from
          multiple spelling suggestions, delete a word, or add it to the dictionary. You can even
          tap to see replacement suggestions for words that are spelled correctly. For specialized
          features or additional languages, you can now download and install third-party
          dictionaries, spell-checkers, and other text services.
        &lt;br /&gt;

        &lt;h3&gt;

          Powerful voice input engine
        &lt;/h3&gt;
Android 4.0 introduces a powerful new voice input engine that offers a continuous &quot;open
          microphone&quot; experience and streaming voice recognition. The new voice input engine lets
          you dictate the text you want, for as long as you want, using the language you want. You
          can speak continously for a prolonged time, even pausing for intervals if needed, and
          dictate punctuation to create correct sentences. As the voice input engine enters text,
          it underlines possible dictation errors in gray. After dictating, you can tap the
          underlined words to quickly replace them from a list of suggestions.
        &lt;br /&gt;

        &lt;div class=&quot;thumbs left double&quot;&gt;

          &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/usage-all-sm.png&quot; /&gt; &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/usage-maps-sm.png&quot; /&gt;
          &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

            Data usage controls let you monitor total usage by network type and application and
            then set limits if needed.
          &lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;

          Control over network data
        &lt;/h3&gt;
Mobile devices can make extensive use of network data for streaming content,
          synchronizing data, downloading apps, and more. To meet the needs of you with tiered or
          metered data plans, Android 4.0 adds new controls for managing network data usage.
        &lt;br /&gt;

        
          In the Settings app, colorful charts show the total data usage on each network type
          (mobile or Wi-Fi), as well as amount of data used by each running application. Based on
          your data plan, you can optionally set warning levels or hard limits on data usage or
          disable mobile data altogether. You can also manage the background data used by
          individual applications as needed.
        &lt;br /&gt;

        &lt;h3&gt;

          Designed for accessibility
        &lt;/h3&gt;
A variety of new features greatly enhance the accessibility of Android 4.0 for blind or
          visually impaired users. Most important is a new explore-by-touch mode that lets you
          navigate without having to see the screen. Touching the screen once triggers audible
          feedback that identifies the UI component below; a second touch in the same component
          activates it with a full touch event. The new mode is especially important to support
          users on new devices that use virtual buttons in the System Bar, rather than dedicated
          hardware buttons or trackballs. Also, standard apps are updated to offer an improved
          accessibility experience. The Browser supports a script-based screen reader for reading
          favorite web content and navigating sites. For improved readability, you can also
          increase the default font size used across the system.
        &lt;br /&gt;

        
          The accessibility experience begins at first setup — a simple touch gesture during setup
          (clockwise square from upper left) activates all accessibility features and loads a setup
          tutorial. Once accessibility features are active, everything visible on the screen can be
          spoken aloud by the standard screen reader.
        &lt;br /&gt;

        &lt;div class=&quot;right thumbs triple&quot;&gt;

          &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/contact-faves-sm.png&quot; /&gt; &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/contact-connect-sm.png&quot; /&gt; &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/contact-email-sm.png&quot; /&gt;
          &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

            Contacts and profiles are integrated across apps and social networks, for a consistent,
            personal experience everywhere — from incoming calls to emails.
          &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;communication&quot;&gt;

          Communication and sharing
        &lt;/h2&gt;
&lt;h3&gt;

          People and profiles
        &lt;/h3&gt;
Throughout the system, your social groups, profiles, and contacts are linked together and
          integrated for easy accessibility. At the center is a new People app that offers richer
          profile information, including a large profile picture, phone numbers, addresses and
          accounts, status updates, events, and a new button for connecting on integrated social
          networks.
        &lt;br /&gt;

        
          Your contact information is stored in a new &quot;Me&quot; profile, allowing easier sharing with
          apps and people. All of your integrated contacts are displayed in an easy to manage list,
          including controls over which contacts are shown from any integrated account or social
          network. Wherever you navigate across the system, tapping a profile photo displays Quick
          Contacts, with large profile pictures, shortcuts to phone numbers, text messaging, and
          more.
        &lt;br /&gt;

        &lt;h3&gt;

          Unified calendar, visual voicemail
        &lt;/h3&gt;
To help organize appointments and events, an updated Calendar app brings together
          personal, work, school, and social agendas. With user permission, other applications can
          contribute events to the calendar and manage reminders, for an integrated view across
          multiple calendar providers. The app is redesigned to let you manage events more easily.
          Calendars are color-coded and you can swipe left or right to change dates and pinch to
          zoom in or out agendas.
        &lt;br /&gt;

        
          In the phone app, a new visual voicemail features integrates incoming messages, voice
          transcriptions, and audio files from one or more providers. Third-party applications can
          integrate with the Phone app to add your own voice messages, transcriptions, and more to
          the visual voicemail inbox.
        &lt;br /&gt;

        &lt;div class=&quot;thumbs left double&quot;&gt;

          &lt;img alt=&quot;&quot; src=&quot;http://www.android.com/images/ics/camera-sm.png&quot; width=&quot;312&quot; /&gt; &lt;img alt=&quot;&quot; src=&quot;http://www.android.com/images/ics/gallery-edit-sm.png&quot; width=&quot;312&quot; /&gt; &lt;img alt=&quot;&quot; src=&quot;http://www.android.com/images/ics/gallery-share-sm.png&quot; width=&quot;312&quot; /&gt;
          &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

            Capture the picture you want, edit, and share instantly.
          &lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;

          &lt;h3&gt;

            Rich and versatile camera capabilities
          &lt;/h3&gt;
The Camera app includes many new features that let you capture special moments with
            great photos and videos. After capturing images, you can edit and share them easily
            with friends.
          &lt;br /&gt;

          
            When taking pictures, continuous focus, zero shutter lag exposure, and decreased
            shot-to-shot speed help capture clear, precise images. Stabilized image zoom lets you
            compose photos and video in the way you want, including while video is recording. For
            new flexibility and convenience while shooting video, you can now take snapshots at
            full video resolution just by tapping the screen as video continues to record.
          &lt;br /&gt;

          
            To make it easier to take great pictures of people, built-in face detection locates
            faces in the frame and automatically sets focus. For more control, you can tap to focus
            anywhere in the preview image.
          &lt;br /&gt;

          
            For capturing larger scenes, the Camera introduces a single-motion panorama mode. In
            this mode, you start an exposure and then slowly turn the Camera to encompass as wide a
            perspective as needed. The Camera assembles the full range of continuous imagery into a
            single panoramic photo.
          &lt;br /&gt;

          
            After taking a picture or video, you can quickly share it by email, text message,
            bluetooth, social networks, and more, just by tapping the thumbnail in the camera
            controls.
          &lt;br /&gt;

          &lt;div class=&quot;right thumbs single&quot;&gt;

            &lt;img alt=&quot;&quot; class=&quot;border&quot; src=&quot;http://www.android.com/images/ics/gallery-widget.png&quot; width=&quot;144&quot; /&gt;
            &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

              A Photo Gallery widget on the home screen.
            &lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;

            Redesigned Gallery app with photo editor
          &lt;/h3&gt;
The Gallery app now makes it easier to manage, show, and share photos and videos. For
            managing collections, a redesigned album layout shows many more albums and offers
            larger thumbnails. There are many ways to sort albums, including by time, location,
            people, and tags. To help pictures look their best, the Gallery now includes a powerful
            photo editor. You can crop and rotate pictures, set levels, remove red eyes, add
            effects, and much more. After retouching, you can select one or multiple pictures or
            videos to share instantly over email, text messaging, bluetooth, social networks, or
            other apps.
          &lt;br /&gt;

          
            An improved Picture Gallery widget lets you look at pictures directly on the home
            screen. The widget can display pictures from a selected album, shuffle pictures from
            all albums, or show a single image. After adding the widget to the home screen, you can
            flick through the photo stacks to locate the image you want, then tap to load it in
            Gallery.
          &lt;br /&gt;

          &lt;div class=&quot;thumbs right double&quot; id=&quot;live-effects&quot;&gt;

            &lt;img alt=&quot;&quot; class=&quot;border&quot; src=&quot;http://www.android.com/images/ics/live-effects.png&quot; width=&quot;297&quot; /&gt;
            &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

              Live Effects let you change backgrounds and use Silly Faces during video.
            &lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;

            Live Effects for transforming video
          &lt;/h3&gt;
Live Effects is a collection of graphical transformations that add interest and fun to
            videos captured in the Camera app. For example, you can change the background behind
            them to any stock or custom image, for just the right setting when shooting video. Also
            available for video is Silly Faces, a set of morphing effects that use state-of-the-art
            face recognition and GPU filters to transform facial features. For example, you can use
            effects such as small eyes, big mouth, big nose, face squeeze, and more. Outside of the
            Camera app, Live Effects is available during video chat in the Google Talk app.
          &lt;br /&gt;

          &lt;div class=&quot;single thumbs left&quot;&gt;

            &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/screenshot-sm.png&quot; /&gt;
            &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

              Snapping a screenshot.
            &lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;

            Sharing with screenshots
          &lt;/h3&gt;
You can now share what&#39;s on your screens more easily by taking screenshots. Hardware
            buttons let them snap a screenshot and store it locally. Afterward, you can view, edit,
            and share the screen shot in Gallery or a similar app.
          &lt;br /&gt;

          &lt;h2 id=&quot;cloud-connected&quot;&gt;

            Cloud-connected experience
          &lt;/h2&gt;
Android has always been cloud-connected, letting you browse the web and sync photos,
            apps, games, email, and contacts — wherever you are and across all of your devices.
            Android 4.0 adds new browsing and email capabilities to let you take even more with
            them and keep communication organized.
          &lt;br /&gt;

          &lt;div class=&quot;thumbs right double&quot;&gt;

            &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/browser-tabs-sm.png&quot; /&gt; &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/browser-sm.png&quot; /&gt;
            &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

              The Browser tabs menu &lt;em&gt;(left)&lt;/em&gt; lets you quickly switch browser tabs. The
              options menu &lt;em&gt;(right)&lt;/em&gt; gives you new ways to manage your browsing experience.
            &lt;/div&gt;
&lt;img alt=&quot;&quot; class=&quot;chart&quot; src=&quot;http://www.android.com/images/ics/bbench-sm.png&quot; width=&quot;310&quot; /&gt;
            &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

              Benchmark comparisons of Android Browser.
            &lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;

            Powerful web browsing
          &lt;/h3&gt;
The Android Browser offers an experience that’s as rich and convenient as a desktop
            browser. It lets you instantly sync and manage Google Chrome bookmarks from all of your
            accounts, jump to your favorite content faster, and even save it for reading later in
            case there&#39;s no network available.
          &lt;br /&gt;

          
            To get the most out of web content, you can now request full desktop versions of web
            sites, rather than their mobile versions. You can set your preference for web sites
            separately for each browser tab. For longer content, you can save a copy for offline
            reading. To find and open saved pages, you can browse a visual list that’s included
            with browser bookmarks and history. For better readability and accessibility, you can
            increase the browser’s zoom levels and override the system default text sizes.
          &lt;br /&gt;

          
            Across all types of content, the Android Browser offers dramatically improved page
            rendering performance through updated versions of the WebKit core and the V8 Crankshaft
            compilation engine for JavaScript. In benchmarks run on a Nexus S device, the Android
            4.0 browser showed an improvement of nearly 220% over the Android 2.3 browser in the V8
            Benchmark Suite and more than 35% in the SunSpider 9.1 JavaScript Benchmark. When run
            on a Galaxy Nexus device, the Android 4.0 browser showed improvement of nearly 550% in
            the V8 benchmark and nearly 70% in the SunSpider benchmark.
          &lt;br /&gt;

          &lt;h3&gt;

            Improved email
          &lt;/h3&gt;
In Android 4.0, email is easier to send, read, and manage. For composing email,
            improved auto-completion of recipients helps with finding and adding frequent contacts
            more quickly. For easier input of frequent text, you can now create quick responses and
            store them in the app, then enter them from a convenient menu when composing. When
            replying to a message, you can now toggle the message to Reply All and Forward without
            changing screens.
          &lt;br /&gt;

          
            For easier browsing across accounts and labels, the app adds an integrated menu of
            accounts and recent labels. To help you locate and organize IMAP and Exchange email,
            the Email app now supports nested mail subfolders, each with synchronization rules. You
            can also search across folders on the server, for faster results.
          &lt;br /&gt;

          
            For enterprises, the Email app supports EAS v14. It supports EAS certificate
            authentication, provides ABQ strings for device type and mode, and allows automatic
            sync to be disabled while roaming. Administrators can also limit attachment size or
            disable attachments.
          &lt;br /&gt;

          
            For keeping track of incoming email more easily, a resizable Email widget lets you
            flick through recent email right from the home screen, then jump into the Email app to
            compose or reply.
          &lt;br /&gt;

          &lt;div class=&quot;single thumbs left&quot;&gt;

            &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/beam-sm.png&quot; /&gt;
            &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

              Android Beam lets you share what you are using with a single tap.
            &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;innovation&quot;&gt;

            Innovation
          &lt;/h2&gt;
Android is continuously driving innovation forward, pushing the boundaries of
            communication and sharing with new capabilities and interactions.
          &lt;br /&gt;

          &lt;h3&gt;

            Android Beam for NFC-based sharing
          &lt;/h3&gt;
Android Beam is an innovative, convenient feature for sharing across two NFC-enabled
            devices, It lets people instantly exchange favorite apps, contacts, music, videos —
            almost anything. It’s incredibly simple and convenient to use — there’s no menu to
            open, application to launch, or pairing needed. Just touch one Android-powered phone to
            another, then tap to send.
          &lt;br /&gt;

          
            For sharing apps, Android Beam pushes a link to the app&#39;s details page in Android
            Market. On the other device, the Market app launches and loads the details page, for
            easy downloading of the app. Individual apps can build on Android Beam to add other
            types of interactions, such as passing game scores, initiating a multiplayer game or
            chat, and more.
          &lt;br /&gt;

          &lt;div class=&quot;thumbs right single&quot;&gt;

            &lt;img alt=&quot;&quot; height=&quot;312&quot; src=&quot;http://www.android.com/images/ics/face-unlock-sm.png&quot; /&gt;
            &lt;div class=&quot;slideshow-content-item-caption&quot;&gt;

              Face recognition lets you unlock your phone with your face.
            &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&quot;face-unlock&quot;&gt;

            Face Unlock
          &lt;/h3&gt;
Android 4.0 introduces a completely new approach to securing a device, making each
            person&#39;s device even more personal — Face Unlock is a new screen-lock option that lets
            you unlock your device with your face. It takes advantage of the device front-facing
            camera and state-of-the-art facial recognition technology to register a face during
            setup and then to recognize it again when unlocking the device. Just hold your device
            in front of your face to unlock, or use a backup PIN or pattern.
          &lt;br /&gt;

          &lt;h3&gt;

            Wi-Fi Direct and Bluetooth HDP
          &lt;/h3&gt;
Support for Wi-Fi Direct lets you connect directly to nearby peer devices over Wi-Fi,
            for more reliable, higher-speed communication. No internet connection or tethering is
            needed. Through third-party apps, you can connect to compatible devices to take
            advantage of new features such as instant sharing of files, photos, or other media;
            streaming video or audio from another device; or connecting to compatible printers or
            other devices.
          &lt;br /&gt;

          
            Android 4.0 also introduces built-in support for connecting to Bluetooth Health Device
            Profile (HDP) devices. With support from third-party apps, you can connect to wireless
            medical devices and sensors in hospitals, fitness centers, homes, and elsewhere.
          &lt;br /&gt;

        &lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/9222185328229076774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/9222185328229076774' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/9222185328229076774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/9222185328229076774'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/part1-introducing-android-40-simple.html' title='Part1: Introducing Android 4.0 - Simple, Beautiful, Useful'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-7801369798994617496</id><published>2012-01-21T09:50:00.000-08:00</published><updated>2012-01-21T09:50:48.557-08:00</updated><title type='text'>First Data Global Payment Gateway for Magento by Booklink</title><content type='html'>&lt;iframe width=&quot;480&quot; height=&quot;270&quot; src=&quot;http://www.youtube.com/embed/k9Ppm0LDirQ?fs=1&quot; frameborder=&quot;0&quot; allowFullScreen=&quot;&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/7801369798994617496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/7801369798994617496' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7801369798994617496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7801369798994617496'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/first-data-global-payment-gateway-for.html' title='First Data Global Payment Gateway for Magento by Booklink'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/k9Ppm0LDirQ/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-8884745831180376943</id><published>2012-01-21T09:45:00.000-08:00</published><updated>2012-01-21T09:45:22.044-08:00</updated><title type='text'>Magento Go, Part 5: Configurable Products - Managing Images</title><content type='html'>&lt;iframe src=&quot;http://www.youtube.com/embed/AWRrzs6P5HU?fs=1&quot; allowfullscreen=&quot;&quot; width=&quot;459&quot; frameborder=&quot;0&quot; height=&quot;344&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/8884745831180376943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/8884745831180376943' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/8884745831180376943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/8884745831180376943'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/magento-go-part-5-configurable-products.html' title='Magento Go, Part 5: Configurable Products - Managing Images'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/AWRrzs6P5HU/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-4534945487493065362</id><published>2012-01-02T02:20:00.000-08:00</published><updated>2012-01-02T02:20:12.557-08:00</updated><title type='text'>Creating Accessible JavaScript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1&gt;
&lt;span class=&quot;subtitle&quot;&gt;Overview of Creating Accessible JavaScript&lt;/span&gt;&lt;/h1&gt;
&lt;div class=&quot;toc&quot;&gt;
 
  &lt;h2&gt;
Article Contents&lt;/h2&gt;
&lt;ol&gt;
&lt;li class=&quot;currentpage&quot;&gt;&lt;span class=&quot;hidden&quot;&gt;Current page: &lt;/span&gt;Page 1: Overview of Creating Accessible Javascript
 
  &lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://webaim.org/techniques/javascript/#javascript&quot;&gt;What is JavaScript?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt; &lt;a href=&quot;http://webaim.org/techniques/javascript/#accessibility&quot;&gt;JavaScript Accessibility Issues &lt;/a&gt;
     &lt;ol&gt;
&lt;li&gt; &lt;a href=&quot;http://webaim.org/techniques/javascript/#noimpact&quot;&gt;JavaScript that does not impact accessibility&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt; &lt;a href=&quot;http://webaim.org/techniques/javascript/#guidelines&quot;&gt;Comparison of JavaScript Guidelines&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://webaim.org/techniques/javascript/#testing&quot;&gt;Testing for JavaScript Reliance&lt;/a&gt;
     &lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://webaim.org/techniques/javascript/#disabling&quot;&gt;Disabling JavaScript&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Page 2: &lt;a href=&quot;http://webaim.org/techniques/javascript/eventhandlers&quot;&gt;JavaScript Event Handlers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Page 3: &lt;a href=&quot;http://webaim.org/techniques/javascript/other&quot;&gt;Other Issues&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Page 4: &lt;a href=&quot;http://webaim.org/techniques/javascript/alternatives&quot;&gt;JavaScript Alternatives&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Page 5: &lt;a href=&quot;http://webaim.org/techniques/javascript/summary&quot;&gt;Accessible JavaScript Summary&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&quot;note&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;javascript&quot; tabindex=&quot;-1&quot;&gt;


&lt;h2&gt;
What is JavaScript?&lt;/h2&gt;
&lt;img alt=&quot;a wheelchair ramp with the word &#39;javascript&#39; written on it&quot; class=&quot;feature-graphic&quot; height=&quot;100&quot; src=&quot;http://webaim.org/techniques/javascript/media/ramp.jpg&quot; style=&quot;float: right; margin-top: 20px;&quot; width=&quot;122&quot; /&gt;This may best be answered by defining what JavaScript is NOT. First,
                        it is not HTML. JavaScript does not use HTML tags or abide by any
                        of the general rules of the HTML language. You can, however,
                        use JavaScript with HTML on a webpage. Second, JavaScript is not Java.
                        Although JavaScript is often called Java, the two are not the same.
                        Java was developed by Sun Microsystems and is a stand-alone programming
                        language. JavaScript, on the other hand, was developed by Netscape
                        Corporation. Although similar to Java in syntax, JavaScript is not a stand-alone
                        language; in order for JavaScript to work, it must be part of a web page
                        that is being displayed in a browser that understands the JavaScript
                        language. Sun&#39;s Java programming language can be implemented in webpages as a built in
                        program, whereas JavaScript scripts are reliant upon the client (visitor&#39;s)
                        computer in order for them to work.&lt;br /&gt;

                &lt;div class=&quot;head&quot;&gt;
Once again, JavaScript is not HTML or a version of HTML.
                        It is a distinct, separate scripting language. HTML is read and
                        processed by the web browser. When the browser reads JavaScript code
                        within your HTML document, it processes the code, then displays any
                        output within the web page. The computer reading the JavaScript must
                        have a JavaScript interpreter, a program that interprets the script
                        and runs it, and that interpreter must be enabled.&lt;/div&gt;
HTML, alone, creates very static pages. There is little user interaction
                        and little by the way of dynamic content within a particular page. 
                        HTML cannot think; it does
                        not have the capabilities to perform mathematics, store variables,
                        or dynamically display content. JavaScript allows your web page to
                        &#39;think&#39;. Although many server-side scripting programs (such as PHP, JPS, ASP, or ColdFusion) have
                        the ability to perform such functions, JavaScript can perform these functions
                        within the client web browser. Because JavaScript is a scripting language, it allows developers
                        to implement little applications into their pages. These programs may do
                        things as simple as changing a graphic when the mouse rolls over it
                        to something as complex as performing advanced mathematical formulas 
                        on user input. &lt;br /&gt;

 &lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;accessibility&quot; tabindex=&quot;-1&quot;&gt;
          
                &lt;h2&gt;
JavaScript Accessibility Issues &lt;/h2&gt;
JavaScript allows developers to add increased interaction, information processing, and  control 
in web-based content. However, JavaScript can also introduce accessibility issues. These issues include:&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Navigation. &lt;/strong&gt;Inability or difficulty navigating using a keyboard or assistive technology. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hidden content.&lt;/strong&gt; Presentation of content or functionality that is not accessible to assistive technologies. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User control. &lt;/strong&gt; Lack of user control over automated content changes. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Confusion/Disorientation. &lt;/strong&gt;Altering or disabling 
the normal functionality of the user agent (browser) or triggering 
events that the user may not be aware of. &lt;/li&gt;
&lt;/ul&gt;
A web page containing JavaScript will typically be fully accessible if the functionality of the 
script is device independent (does not require only a mouse or only a keyboard) and the information (content) is available 
to assistive technologies. Unfortunately, there is no easy fix that can be applied to solve all 
accessibility problems associated with JavaScript. 


 The only way to ensure  JavaScript accessibility  is by evaluating each individual script and 
 devising a unique solution to the accessibility problem it poses.

Developers must be familiar with the issues surrounding JavaScript accessibility and apply 
techniques to do one or both of the following:&lt;br /&gt;

&lt;ol&gt;
&lt;li&gt;Ensure the JavaScript is directly accessible&lt;/li&gt;
&lt;li&gt;Provide an accessible, non-JavaScript alternative&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;noimpact&quot; tabindex=&quot;-1&quot;&gt;

&lt;h3&gt;
JavaScript that does not impact accessibility &lt;/h3&gt;
Just because JavaScript is utilized on a page does not mean that the page is inaccessible. In 
many cases, JavaScript can  be used to increase accessibility. Additional information, warnings, 
or instructions can be given to users through JavaScript prompts. For instance,  under the Section 
508 guidelines of   United States law, a user must be notified when a timed response is 
required and given sufficient time to indicate more time is required. Such functionality would be 
difficult with HTML alone. &lt;br /&gt;

JavaScript is sometimes used to create visual interface elements that do not affect accessibility. 
JavaScript is commonly used for image rollovers, where  one image is replaced with another when the 
mouse is placed above it; for example, when a navigation item changes to display a shadow, glow, or 
highlight when the user mouses over it. &lt;br /&gt;

&lt;div class=&quot;example&quot;&gt;

Place your mouse over the following image to see a JavaScript example that does not impact accessibility. &lt;br /&gt;

&lt;a href=&quot;&quot;&gt;&lt;img alt=&quot;Home&quot; height=&quot;40&quot; id=&quot;homepic&quot; src=&quot;http://webaim.org/techniques/javascript/media/off.gif&quot; width=&quot;100&quot; /&gt;&lt;/a&gt;&lt;br /&gt;

&lt;h4&gt;
Problems&lt;/h4&gt;
None. In this example, there is no important content or functionality introduced by the JavaScript. 
The swapping of images is purely cosmetic. &lt;br /&gt;

&lt;h4&gt;
Solution&lt;/h4&gt;
No additional accessibility techniques are required. Remember, the image itself 
      must have alternative text (i.e., &lt;code&gt;&amp;lt;img alt=&quot;home&quot;...&amp;gt;&lt;/code&gt;). 
      You can also accomplish &lt;a class=&quot;external&quot; href=&quot;http://www.alistapart.com/articles/rollovers/&quot; title=&quot;Link to External Site&quot;&gt;image 
      rollovers without using JavaScript&lt;span&gt; - external 
      link&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;

&lt;/div&gt;
Such uses of JavaScript do not need additional accessibility features incorporated because important 
content is not displayed or functionality introduced by such scripting.&lt;br /&gt;

Making JavaScript accessible involves looking at the following issues. Each of these will be discussed 
in the next lessons.&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt; When using event handlers, use only those that are device independent (e.g., do not require the 
  use of the mouse only).&lt;/li&gt;
&lt;li&gt;Content and functionality that is provided through scripting must be made accessible to assistive 
  technologies.&lt;/li&gt;
&lt;li&gt;Web pages that utilize scripting must be fully navigable using a keyboard.&lt;/li&gt;
&lt;li&gt;JavaScript should not modify or override normal browser functionality in a way that may cause confusion.&lt;/li&gt;
&lt;li&gt;When JavaScript cannot be made natively accessible, an accessible alternative must be provided. &lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;guidelines&quot; tabindex=&quot;-1&quot;&gt;

&lt;h2&gt;
Comparison of JavaScript Guidelines &lt;/h2&gt;
Section 508 of the  Rehabilitation Act (in the United States) and the W3C Web Content Accessibility Guidelines (WCAG) 1.0 both 
address the accessibility of scripting elements. They require that the functionality and content of scripts 
be  accessible to assistive technologies such as screen readers. Additionally, users must be given control 
over time-based content changes. There are, however, differences between the two accessibility guidelines. 
WCAG  requires that content and functionality be accessible with scripting disabled and that users should 
be alerted if JavaScript changes the appearance or functionality of the browser window, whereas Section 
508 only requires that the scripting be made accessible or that an accessible alternative is provided. &lt;br /&gt;

&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;testing&quot; tabindex=&quot;-1&quot;&gt;

&lt;h2&gt;
Testing for JavaScript Reliance&lt;/h2&gt;
As mentioned above, your web pages should be fully functional with JavaScript 
  disabled. This is required under Priority 1 of the Web Content Accessibility Guidelines.
  Section 508 does not require the page to function if JavaScript is disabled, but does require
  that the scripts themselves be natively accessible. This tutorial will teach strategies for 
  making your scipts natively accessible and assumes that if you, as a developer, want to 
  achieve a higher level of accessibility or comply with the Web Content Accessibility Guidelines,
  that you will also test your pages to ensure that they work with JavaScript disabled.&lt;br /&gt;

 
&lt;div class=&quot;section&quot; id=&quot;disabling&quot; tabindex=&quot;-1&quot;&gt;
        
 &lt;h3&gt;
Disabling JavaScript  &lt;/h3&gt;
&lt;div class=&quot;example&quot;&gt;

   Follow the directions to disable or enable JavaScript in your browser. You can also &lt;a href=&quot;http://webaim.org/techniques/javascript/media/jstest.htm&quot;&gt;determine if JavaScript is disabled&lt;/a&gt;.
 Test a JavaScript enabled web page and see if the content and 
functionality are accessible. Be sure to re-enable JavaScript when 
you&#39;re done. &lt;br /&gt;

   &lt;strong&gt;Internet Explorer 6.X &lt;/strong&gt;
   &lt;br /&gt;

   &lt;ol&gt;
&lt;li&gt;Open Internet Explorer. &lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Tools &amp;gt; Internet Options&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;Internet Options&lt;/strong&gt;&lt;em&gt; &lt;/em&gt; dialog box select the &lt;strong&gt;Security&lt;/strong&gt;&lt;em&gt; 
      &lt;/em&gt; tab. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Custom Level&lt;/strong&gt; button at bottom. The &lt;strong&gt;Security 
      Settings&lt;/strong&gt; dialog box will pop up. &lt;/li&gt;
&lt;li&gt;Under the&lt;strong&gt; Scripting &lt;/strong&gt;category, enable/disable &lt;strong&gt;Active 
      Scripting, Allow paste options via script&lt;/strong&gt;&lt;em&gt; &lt;/em&gt; and &lt;strong&gt;Scripting 
      of Java applets&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt;&lt;em&gt; &lt;/em&gt; twice to close out. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Refresh&lt;/strong&gt;. &lt;/li&gt;
&lt;/ol&gt;
&lt;strong&gt;Netscape 7.X &lt;/strong&gt; &lt;br /&gt;

   &lt;ol&gt;
&lt;li&gt;Open Netscape. &lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Edit &amp;gt; Preferences&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Click the arrow next to &lt;strong&gt;Advanced&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Scripts &amp;amp; Plugins&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Check/uncheck &lt;strong&gt;Navigator&lt;/strong&gt;&lt;em&gt; &lt;/em&gt; beneath &quot;Enable Javascript 
      for&quot;. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Reload&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;strong&gt;Opera 7.X &lt;/strong&gt; &lt;br /&gt;

   &lt;ol&gt;
&lt;li&gt;Open Opera. &lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;File &amp;gt; Quick Preferences&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Check/uncheck &lt;strong&gt;Enable Javascript&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Reload&lt;/strong&gt;.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&quot;section&quot; id=&quot;jsoverview&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Overview&lt;/h2&gt;
JavaScript can be processed using &lt;code class=&quot;markup&quot;&gt;&amp;lt;script&amp;gt;&lt;/code&gt; elements and event handlers. The &lt;code class=&quot;markup&quot;&gt;&amp;lt;script&amp;gt;&lt;/code&gt; element can contain JavaScript code directly:&lt;br /&gt;


   &lt;div class=&quot;programlisting&quot;&gt;

    &lt;code class=&quot;markup&quot;&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
  &amp;lt;!--
  function doit();
  --&amp;gt;
&amp;lt;/script&amp;gt;
&lt;/code&gt;
   &lt;/div&gt;
or can open an external JavaScript (.js) file:&lt;br /&gt;


   &lt;div class=&quot;programlisting&quot;&gt;

    &lt;code class=&quot;markup&quot;&gt;
&amp;lt;script type=&quot;text/javascript&quot; src=&quot;scripts.js&quot;&amp;gt;
&lt;/code&gt;
   &lt;/div&gt;
The &lt;code class=&quot;markup&quot;&gt;&amp;lt;script&amp;gt;&lt;/code&gt; element is 
processed when the page is loaded and requires no user intervention. The
 contents and functionality of the script processed within the &lt;code class=&quot;markup&quot;&gt;&amp;lt;script&amp;gt;&lt;/code&gt; element must be directly accessible or an accessible alternative of the content and functionality must be provided.&lt;br /&gt;


   Event handlers accompany existing &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt;
 code and are triggered by a browser or user event - such as when the 
page loads, when the user clicks the mouse, or when the time is 8 p.m. 
Some event handlers are dependent upon use of a mouse or keyboard. These
 are called device dependent event handlers. Other event handlers are 
device independent and are triggered by both the mouse and keyboard or 
by other means. Using device dependent event handlers may cause the 
content to be inaccessible to someone that is not able to use the device
 that is required for that specific event handler.&lt;br /&gt;

  &lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;onmouseover&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
&lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onMouseOut&lt;/code&gt;&lt;/h2&gt;
The &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt; event handler is triggered when the mouse cursor is placed over an item. As its name implies, &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt; requires the use of a mouse, thus it is a device dependent event handler and may cause accessibility issues. &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt;, and its companion, &lt;code class=&quot;markup&quot;&gt;onMouseOut&lt;/code&gt;, can be used, as long as any important content or functionality is also available without using the mouse.&lt;br /&gt;


   &lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
Example 1&lt;/h3&gt;
Place your mouse over the following image to see an example of &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt;.
 When the mouse is placed over the image of the word &quot;Accessibility&quot;, 
another image appears in its place which presents the definition of the 
word &quot;Accessibility&quot;.&lt;br /&gt;


    &lt;a href=&quot;http://webaim.org/techniques/javascript/eventhandlers#&quot;&gt;&lt;img alt=&quot;Accessibility - The quality of being accessible, or of admitting approach; receptibility.&quot; height=&quot;79&quot; id=&quot;ex1pic&quot; src=&quot;http://webaim.org/techniques/javascript/media/mouseover.gif&quot; width=&quot;289&quot; /&gt;&lt;/a&gt;&lt;br /&gt;


    &lt;div class=&quot;programlisting&quot;&gt;

     &lt;code class=&quot;markup&quot;&gt;
&amp;lt;a href=&quot;page.htm&quot; &lt;strong&gt;onmouseover&lt;/strong&gt;=&quot;document.images[&#39;myimage&#39;].src=&#39;imageoff.gif&#39;;&quot; &lt;strong&gt;onmouseout&lt;/strong&gt;=&quot;document.images[&#39;myimage&#39;].src=&#39;imageon.gif&#39;;&quot;&amp;gt;
&amp;lt;img
 src=&quot;media/imageoff.gif&quot; width=&quot;289&quot; height=&quot;79&quot; id=&quot;myimage&quot; 
alt=&quot;Accessibility - The quality of being accessible, or of admitting 
approach; receptibility.&quot; /&amp;gt;
&amp;lt;/a&amp;gt;
&lt;/code&gt;
    &lt;/div&gt;
&lt;div class=&quot;important&quot;&gt;

     &lt;span class=&quot;title&quot;&gt;&lt;strong&gt;Important&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;


     All of the examples in this lesson are coded to be &lt;acronym title=&quot;Extensible HyperText Markup Language&quot;&gt;XHTML&lt;/acronym&gt; 1.0 Strict compliant. &lt;acronym title=&quot;Extensible HyperText Markup Language&quot;&gt;XHTML&lt;/acronym&gt; requires lower-case event handler names (e.g., &lt;code class=&quot;markup&quot;&gt;onmouseover&lt;/code&gt; instead of &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt;).&lt;br /&gt;

    &lt;/div&gt;
Try navigating to the image using the keyboard. Notice that the 
additional information does not display. The alternative text for the 
image provides the content displayed using the &lt;code class=&quot;markup&quot;&gt;onmouseover&lt;/code&gt;
 event handler. This allows users who know how to access this 
alternative text to get the content, but is not a truly universal 
solution.&lt;br /&gt;


    &lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Problems&lt;/h4&gt;
In this example, additional content is being displayed using &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt;.
 This content can only be viewed if the user uses a mouse to hover over 
the image. It is not available to someone who is using the keyboard to 
navigate through the page. The &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt; event handler cannot be made directly accessible to keyboard users. Thus, an alternative must be provided.&lt;br /&gt;

    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Partial Solution&lt;/h4&gt;
Place the additional content in the alternative text of the 
image itself. This would work for screen reader users - the screen 
reader would read the alternative text. But for sighted users whose 
browser does not display alternative text for images or who do not know 
to mouse over the image to see the alternative text, this is not a 
viable alternative. Still, the image must have equivalent alternative 
text.&lt;br /&gt;

    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Solutions&lt;/h4&gt;
In addition to &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onMouseOut&lt;/code&gt;, use &lt;code class=&quot;markup&quot;&gt;onFocus&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onBlur&lt;/code&gt;. These actions will be triggered when the keyboard is used to navigate to and from a link that surrounds the &lt;code class=&quot;markup&quot;&gt;&amp;lt;img&amp;gt;&lt;/code&gt; element.&lt;br /&gt;


     &lt;a href=&quot;http://webaim.org/techniques/javascript/media/generic_link.htm&quot;&gt;&lt;img alt=&quot;Accessibility - The quality of being accessible, or of admitting approach; receptibility.&quot; height=&quot;79&quot; id=&quot;ex1pic2&quot; src=&quot;http://webaim.org/techniques/javascript/media/mouseover.gif&quot; width=&quot;289&quot; /&gt;&lt;/a&gt;&lt;br /&gt;


     &lt;div class=&quot;programlisting&quot;&gt;

      &lt;code class=&quot;markup&quot;&gt;
&amp;lt;a href=&quot;page.htm&quot;
onmouseover=&quot;document.images[&#39;myimage&#39;].src=&#39;imageon.gif&#39;;&quot; &lt;strong&gt;onfocus&lt;/strong&gt;=&quot;document.images[&#39;myimage&#39;].src=&#39;imageon.gif&#39;;&quot;
onmouseout=&quot;document.images[&#39;myimage&#39;].src=&#39;imageoff.gif&#39;;&quot; &lt;strong&gt;onblur&lt;/strong&gt;=&quot;document.images[&#39;myimage&#39;].src
 = &#39;imageoff.gif&#39;;&quot;&amp;gt;

&amp;lt;img src=&quot;imageoff.gif&quot; width=&quot;289&quot; height=&quot;79&quot; id=&quot;myimage&quot; 
alt=&quot;Accessibility - The quality of being accessible, or of admitting 
approach; receptibility.&quot; /&amp;gt;&amp;lt;/a&amp;gt;
&lt;/code&gt;
     &lt;/div&gt;
You must still provide the descriptive alternative text for non-visual users, but &lt;code class=&quot;markup&quot;&gt;onFocus&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onBlur&lt;/code&gt; will provide the visual image swap for users that are using a keyboard only.&lt;br /&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
Example 2&lt;/h3&gt;
A common use of &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onMouseOut&lt;/code&gt;
 is for fly-out or drop-down navigation systems. Place your mouse over 
the menu items below to view an example of drop-down menus. When the 
mouse is placed over the main menu items (&lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt;), additional sub-menu items appear below. When the mouse is removed from the menu system (&lt;code class=&quot;markup&quot;&gt;onMouseOut&lt;/code&gt;), then the sub-menus disappear.&lt;br /&gt;


    &lt;table style=&quot;width: 360px;&quot;&gt;
     &lt;tbody&gt;
&lt;tr&gt;
      &lt;td class=&quot;menuActuator&quot; style=&quot;width: 120px;&quot;&gt;
       &lt;a href=&quot;http://webaim.org/techniques/javascript/media/products.htm&quot;&gt;Products&lt;/a&gt;

       &lt;div class=&quot;td_div&quot;&gt;
 
              &lt;div id=&quot;menu1Container&quot; style=&quot;visibility: hidden;&quot;&gt;
 
                &lt;div class=&quot;menu&quot; id=&quot;menu1Content&quot; style=&quot;top: -90px;&quot;&gt;
 
                  &lt;ul&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;

      &lt;td class=&quot;menuActuator&quot; style=&quot;width: 120px;&quot;&gt;
       &lt;a href=&quot;http://webaim.org/techniques/javascript/media/services.htm&quot;&gt;Services&lt;/a&gt;

       &lt;div class=&quot;td_div&quot;&gt;
 
              &lt;div id=&quot;menu2Container&quot; style=&quot;visibility: hidden;&quot;&gt;
 
                &lt;div class=&quot;menu&quot; id=&quot;menu2Content&quot; style=&quot;top: -130px;&quot;&gt;
 
                  &lt;ul&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;

      &lt;td class=&quot;menuActuator&quot; style=&quot;width: 120px;&quot;&gt;
       &lt;a href=&quot;http://webaim.org/techniques/javascript/media/support.htm&quot;&gt;Support&lt;/a&gt;

       &lt;div class=&quot;td_div&quot;&gt;
 
              &lt;div id=&quot;menu3Container&quot; style=&quot;visibility: hidden;&quot;&gt;
 
                &lt;div class=&quot;menu&quot; id=&quot;menu3Content&quot; style=&quot;top: -90px;&quot;&gt;
 
                  &lt;ul&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
     &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Problems&lt;/h4&gt;
Additional content and functionality is being displayed using &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt;.
 In this example, JavaScript is controlling the display of Cascading 
Style Sheet elements within the page. The sub-menu items will only be 
visible if the mouse is placed over the main menu item. These items may 
not be available if JavaScript is disabled and may not be read by 
assistive technologies.&lt;br /&gt;

    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Solutions&lt;/h4&gt;
When possible, use additional event handlers that allow keyboard
 navigation. When this is not possible, you must provide redundant 
navigation. This can be done one of two ways. First, provide links 
within the main content of the page to the pages displayed in the 
sub-menu navigation. This is often done as a list of categorized links 
at the bottom of the page. The downside of this approach is that the 
navigation is only accessible at the bottom of the page, which might be 
counter-intuitive to most users.&lt;br /&gt;


     
        A second method of providing the redundant navigation is to add a standard 
          &lt;code class=&quot;markup&quot;&gt;href&lt;/code&gt; link from each main navigation items 
          (e.g., Product, Services, etc.) to a separate web page that contains 
          the sub-menu navigation items. If you select the Products, Services, 
          or Support links above you will see an example of providing redundant 
          navigation.&lt;br /&gt;


     &lt;div class=&quot;example&quot;&gt;

      &lt;span class=&quot;title&quot;&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;


      &lt;div class=&quot;programlisting&quot;&gt;

       &lt;code class=&quot;markup&quot;&gt;
&amp;lt;a &lt;strong&gt;href=&quot;productlinks.htm&quot;&lt;/strong&gt; onmouseover=&quot;SlideOutMenu();&quot; onmouseout=&quot;SlideInMenu();&quot;&amp;gt;Products&amp;lt;/a&amp;gt;
&lt;/code&gt;
      &lt;/div&gt;
&lt;/div&gt;
While this method does require the creation of an additional 
page and introduces an additional step, it also provides full access to 
the navigation elements in an intuitive way. This method also allows the
 sub-menu items to be accessible if JavaScript is disabled.&lt;br /&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;onfocus&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
&lt;code class=&quot;markup&quot;&gt;onFocus&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onBlur&lt;/code&gt;&lt;/h2&gt;
These event handlers are typically used with form elements, such as text fields, radio buttons, and submit buttons. &lt;code class=&quot;markup&quot;&gt;onFocus&lt;/code&gt; is triggered when the cursor is placed on or within a specific form element. &lt;code class=&quot;markup&quot;&gt;onBlur&lt;/code&gt; is triggered when the cursor leaves a form element.&lt;br /&gt;


   
    Both of these event handlers are device independent, meaning that they 
      can be performed with the mouse, keyboard, or other assistive technology. 
      The actions that are performed as a result of these event handlers must 
      be analyzed to determine if they cause accessibility problems. Typically, 
      these events do not cause accessibility issues unless they are modifying 
      the default behavior of the web browser or are interfering with keyboard 
      navigation within the web page.&lt;br /&gt;


   &lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
Example 1&lt;/h3&gt;
&lt;form action=&quot;media/generic_link.htm&quot;&gt;

     Place your cursor within the following textbox to see an example of the &lt;code class=&quot;markup&quot;&gt;onFocus&lt;/code&gt; event handler.&lt;br /&gt;


     &lt;label for=&quot;fname&quot;&gt;Enter your name&lt;/label&gt; : &lt;input id=&quot;fname&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;

    &lt;/form&gt;
&lt;div class=&quot;programlisting&quot;&gt;

     &lt;code class=&quot;markup&quot;&gt;
&amp;lt;input id=&quot;fname&quot; type=&quot;text&quot; &lt;strong&gt;onfocus&lt;/strong&gt;=&quot;alert(&#39;Enter your first name only&#39;);&quot; /&amp;gt;
&lt;/code&gt;
    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Problems&lt;/h4&gt;
None. Although the alert window may be distracting and 
unnecessary, it does not introduce any serious accessibility issues. The
 alert is triggered when the text box gains focus, either by using the 
keyboard or mouse. JavaScript alerts are read by most modern screen 
readers and can be used to increase the usability of forms by providing 
timely feedback, instructions, or cues. However, if JavaScript is 
disabled, then the alert will not be available at all.&lt;br /&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
Example 2&lt;/h3&gt;
&lt;form action=&quot;#&quot; id=&quot;ex2&quot;&gt;

     In this example, the &lt;code class=&quot;markup&quot;&gt;onBlur&lt;/code&gt; event 
triggers JavaScript code that changes the functionality of the Web 
browser. Place your mouse into the following text box and enter a number
 between 1 and 10. Then press the &lt;span class=&quot;keycap&quot;&gt;&lt;strong&gt;Tab&lt;/strong&gt;&lt;/span&gt; key or click the mouse outside of the text box to trigger the &lt;code class=&quot;markup&quot;&gt;onBlur&lt;/code&gt;
 event which will validate the number you entered to ensure it is 
correct and present feedback regarding your answer. If it is incorrect, 
the text box will retain the cursor focus until you enter the correct 
number. In this example, &lt;label for=&quot;input1&quot;&gt;you &lt;strong&gt;MUST&lt;/strong&gt; enter the correct answer of &#39;6&#39;&lt;/label&gt; to allow the browser to navigate to other portions of the page.&lt;br /&gt;


     Guess a number between 1 and 10?&lt;br /&gt;


     

     

     

     Enter Answer: &lt;input id=&quot;input1&quot; name=&quot;text&quot; size=&quot;5&quot; type=&quot;text&quot; /&gt; &lt;br /&gt;


     &lt;div class=&quot;programlisting&quot;&gt;

      &lt;code class=&quot;markup&quot;&gt;
&amp;lt;input type=&quot;text&quot; id=&quot;input1&quot; size=&quot;5&quot; &lt;strong&gt;onblur&lt;/strong&gt;=&quot;checkAnswer();&quot;&amp;gt;
&lt;/code&gt;
     &lt;/div&gt;
&lt;/form&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Problems&lt;/h4&gt;
Although the &lt;code class=&quot;markup&quot;&gt;onblur&lt;/code&gt; event is device 
independent, it is being used to execute JavaScript code that makes the 
page difficult to navigate. The textbox maintains focus until the 
correct answer is given. This change in browser default behavior may be 
confusing and restricting. Also, the feedback is displayed in a 
different part of the page. Because focus is maintained within the text 
box, a screen reader will not be able to access the feedback text or any
 other part of the page until the correct answer is entered.&lt;br /&gt;

    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Solution&lt;/h4&gt;
Do not force the focus to remain within the text box. Allow the 
user to navigate throughout the page. Display the feedback on another 
page after the form has been submitted (works without JavaScript) or 
display the feedback with a JavaScript alert (requires JavaScript). Try 
entering a letter into the textbox above to see a JavaScript alert 
feedback message.&lt;br /&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;onclick&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
&lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onDblClick&lt;/code&gt;&lt;/h2&gt;
The &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; event handler is triggered when the mouse is pressed when over an &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; element. &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; is intended to be a mouse dependent event handler. However, if the &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; event handler is used with hypertext links or form controls, then most major browsers and assistive technologies trigger &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; if the &lt;span class=&quot;keycap&quot;&gt;&lt;strong&gt;Enter&lt;/strong&gt;&lt;/span&gt; key is pressed when the link or control has focus. In these cases, &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; is a device independent event handler. Nevertheless, the &lt;span class=&quot;keycap&quot;&gt;&lt;strong&gt;Enter&lt;/strong&gt;&lt;/span&gt; key will not trigger the &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; event if it is used with non-link and non-control elements, such as plain text or table cells.&lt;br /&gt;


   The &lt;code class=&quot;markup&quot;&gt;onDblClick&lt;/code&gt; event handler is associated with the double click of a mouse on a selected &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; element. There is no device independent or keyboard equivalent to &lt;code class=&quot;markup&quot;&gt;onDblClick&lt;/code&gt;, which should be avoided.&lt;br /&gt;


   &lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
Example 1&lt;/h3&gt;
The following link triggers a JavaScript confirmation box which allows you to confirm whether you want to view the page or not.&lt;br /&gt;


    &lt;a href=&quot;http://webaim.org/techniques/javascript/media/generic_link.htm&quot;&gt;View this onClick example&lt;/a&gt;&lt;br /&gt;


    &lt;div class=&quot;programlisting&quot;&gt;

     &lt;code class=&quot;markup&quot;&gt;
&amp;lt;a href=&quot;page.htm&quot; &lt;strong&gt;onclick&lt;/strong&gt;=&quot;return confirm(&#39;Are you sure you want to view this page?&#39;);&quot;&amp;gt;View this onClick example&amp;lt;/a&amp;gt;&lt;/code&gt;    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Problems&lt;/h4&gt;
None. The confirmation box is read by all major screen readers. By using the &lt;code class=&quot;markup&quot;&gt;return&lt;/code&gt; JavaScript parameter, the link action is cancelled if the user selects &lt;span class=&quot;menuchoice&quot;&gt;No&lt;/span&gt; in the confirmation dialog box. If JavaScript is disabled, the link will work normally.&lt;br /&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
Example 2&lt;/h3&gt;
The following text is styled to appear like a link (blue and underlined), but is plain text that has an &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; event which opens another document in the browser window. Use the mouse to click the following text.&lt;br /&gt;


    &lt;div style=&quot;color: blue; text-decoration: underline;&quot;&gt;
View another onClick example&lt;/div&gt;
&lt;div class=&quot;programlisting&quot;&gt;

     &lt;code class=&quot;markup&quot;&gt;
&amp;lt;p style=&quot;color:blue; text-decoration:underline&quot; &lt;strong&gt;onclick&lt;/strong&gt;=&quot;location.href=&#39;page.htm&#39;&quot;&amp;gt;View another onClick example&amp;lt;/p&amp;gt;&lt;/code&gt;    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Problems&lt;/h4&gt;
Because the text is not a hypertext link or form control, it 
does not receive focus while navigating with the keyboard. Because it 
does not gain focus, the keyboard cannot be used to activate the &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; event.&lt;br /&gt;

    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Solution&lt;/h4&gt;
Use the &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; event handler on a link or form control instead of an element that cannot be accessed using a keyboard.&lt;br /&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
Example 3&lt;/h3&gt;
A very common use of JavaScript is to validate form information. 
The following form will use JavaScript to allow you to confirm the 
information you have entered.&lt;br /&gt;


    Enter your name in the following box, then press the &lt;span class=&quot;menuchoice&quot;&gt;Submit&lt;/span&gt; button.&lt;br /&gt;


    &lt;form action=&quot;media/generic_link.htm&quot;&gt;

     &lt;label for=&quot;yourname&quot;&gt;Name:&lt;/label&gt; &lt;input id=&quot;yourname&quot; name=&quot;yourname&quot; type=&quot;text&quot; /&gt; &lt;br /&gt;

    &lt;/form&gt;
&lt;div class=&quot;programlisting&quot;&gt;

     &lt;code class=&quot;markup&quot;&gt;
&amp;lt;form action=&quot;page.htm&quot; onsubmit=&quot;validate(); return false;&quot;&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;label for=&quot;yourname&quot;&amp;gt;Name:&amp;lt;/label&amp;gt;&amp;lt;input type=&quot;text&quot; id=&quot;yourname&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&quot;button&quot; value=&quot;Submit&quot; &lt;strong&gt;onclick&lt;/strong&gt;=&quot;validate();&quot; /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;/code&gt;    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Problems&lt;/h4&gt;
The confirmation and alert dialog boxes that are triggered by the &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; 
          event are accessible to browsers and assistive technologies that have 
          JavaScript enabled. Validating the form information with a server side 
          script and then displaying feedback on another web page allows you to 
          bypass any problems that may occur in the JavaScript code and allows 
          the form to validate if JavaScript is disabled. If JavaScript is used 
          to validate the form, make sure that all form elements and functionality 
          can be completed using the keyboard. Because the &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; 
          handler is used with a form element, it is activated using both the 
          mouse and the keyboard.&lt;br /&gt;


     &lt;div class=&quot;note&quot;&gt;

      &lt;span class=&quot;title&quot;&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;


      Because most browsers will submit the form when the &lt;span class=&quot;keycap&quot;&gt;&lt;strong&gt;Enter&lt;/strong&gt;&lt;/span&gt; key is pressed, the &lt;code class=&quot;markup&quot;&gt;onsubmit&lt;/code&gt; event handler has been added to the &lt;code class=&quot;markup&quot;&gt;&amp;lt;form&amp;gt;&lt;/code&gt; tag to ensure that the form will validate if the user does not activate the &lt;span class=&quot;menuchoice&quot;&gt;Submit&lt;/span&gt; button, but presses the &lt;span class=&quot;keycap&quot;&gt;&lt;strong&gt;Enter&lt;/strong&gt;&lt;/span&gt; key while focus is in the text box. Also notice the required form label for the text box.&lt;br /&gt;

     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
Example 4&lt;/h3&gt;
This example also validates the form information, but feedback is displayed in another place within the page.&lt;br /&gt;


    How many items are in a dozen? Enter the amount into the box below, then press the &lt;span class=&quot;menuchoice&quot;&gt;Check&lt;/span&gt; button.&lt;br /&gt;


    &lt;form action=&quot;eventhandlers&quot;&gt;

     

     

     

     &lt;label for=&quot;answerbox&quot;&gt;Enter Answer:&lt;/label&gt; &lt;input id=&quot;answerbox&quot; type=&quot;text&quot; /&gt; &lt;br /&gt;

    &lt;/form&gt;
&lt;div class=&quot;programlisting&quot;&gt;

     &lt;code class=&quot;markup&quot;&gt;
&amp;lt;form action=&quot;page.htm&quot; onsubmit=&quot;checkAnswer2(); return false;&quot;&amp;gt;&lt;br /&gt;
&amp;lt;p class=&quot;invis&quot; id=&quot;answercorrect&quot;&amp;gt;Correct, there are 12 items in a dozen.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&quot;invis&quot; id=&quot;answerwrong&quot;&amp;gt;Incorrect. There are 12 items in a dozen.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;label for=&quot;answerbox&quot;&amp;gt;Enter Answer:&amp;lt;/label&amp;gt;&lt;br /&gt;
&amp;lt;input type=&quot;text&quot; id=&quot;answerbox&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;input type=&quot;submit&quot; &lt;strong&gt;onclick&lt;/strong&gt;=&quot;checkAnswer2()&quot; value=&quot;Check&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;/code&gt;    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Problems&lt;/h4&gt;
The feedback is not presented in a manner that would be 
accessible to some assistive technologies. In this example, JavaScript 
is modifying the display style parameters for elements within the page 
to make them visible or invisible based upon the response. The screen 
reader user would not be aware that additional content has suddenly 
appeared within the page.&lt;br /&gt;

    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Solutions&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Validate the form information with a server side script, then display the feedback on another page.&lt;/li&gt;
&lt;li&gt;Provide the feedback in a way that is accessible, such as a JavaScript alert or another form element.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;onchange&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
&lt;code class=&quot;markup&quot;&gt;onChange&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onSelect&lt;/code&gt;&lt;/h2&gt;
The &lt;code class=&quot;markup&quot;&gt;onChange&lt;/code&gt; event handler is 
triggered when a form element is selected and changed (for example, when
 a radio button is initially selected or when the text changes within a 
text box). The &lt;code class=&quot;markup&quot;&gt;onSelect&lt;/code&gt; event handler is 
processed when text is selected within a text field or text area. 
Although these event handlers are device independent and can be 
activated using the mouse, keyboard, or other device, the actions that 
are performed as a result of these event handlers must be analyzed to 
determine if they cause accessibility problems.&lt;br /&gt;


   &lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
&lt;code class=&quot;markup&quot;&gt;onChange&lt;/code&gt; example&lt;/h3&gt;
The following drop-down menu form element is used for navigation.
 By selecting an item from the list, JavaScript will automatically open 
the specified page within the browser.&lt;br /&gt;


    &lt;div class=&quot;note&quot;&gt;

     &lt;span class=&quot;title&quot;&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;


     In some browsers you may have to hit the &lt;span class=&quot;keycap&quot;&gt;&lt;strong&gt;Enter&lt;/strong&gt;&lt;/span&gt; key or click on the page after selecting a menu item to activate the &lt;code class=&quot;markup&quot;&gt;onchange&lt;/code&gt; event handler. Click on the &lt;span class=&quot;menuchoice&quot;&gt;Back&lt;/span&gt; button in the browser to return to this page.&lt;br /&gt;

    &lt;/div&gt;
&lt;form action=&quot;media/generic_link.htm&quot;&gt;

     &lt;label for=&quot;selectPage&quot;&gt;Go to:&lt;/label&gt; 
      

      

      

      
     &lt;br /&gt;

    &lt;/form&gt;
&lt;div class=&quot;programlisting&quot;&gt;

     &lt;code class=&quot;markup&quot;&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
&amp;lt;!--
  &lt;br /&gt;
  function goto_URL(object) {&lt;br /&gt;
  window.location.href = object.options[object.selectedIndex].value;
  }&lt;br /&gt;
  //--&amp;gt;&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;form action=&quot;page.htm&quot; onsubmit=&quot;return false;&quot;&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&amp;lt;label for=&quot;selectPage&quot;&amp;gt;Go to:&amp;lt;/label&amp;gt;&lt;br /&gt;
  &amp;lt;select name=&quot;selectName&quot; &lt;strong&gt;onchange&lt;/strong&gt;=&quot;goto_URL(this.form.selectName)&quot;&amp;gt;&lt;br /&gt;
  &amp;lt;option value=&quot;&quot;&amp;gt;Select a page:&amp;lt;/option&amp;gt;&lt;br /&gt;
  &amp;lt;option value=&quot;page.htm&quot;&amp;gt;Page 1&amp;lt;/option&amp;gt;&lt;br /&gt;
  &amp;lt;option value=&quot;page.htm&quot;&amp;gt;Page 2&amp;lt;/option&amp;gt;&lt;br /&gt;
  &amp;lt;option value=&quot;page.htm&quot;&amp;gt;Page 3&amp;lt;/option&amp;gt;&lt;br /&gt;
  &amp;lt;/select&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;/form&amp;gt;&lt;/code&gt;
    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h4&gt;
Problems&lt;/h4&gt;
The JavaScript causes the browser to go to a new page using &lt;code class=&quot;markup&quot;&gt;onChange&lt;/code&gt; or when the user selects an item from the select list. If the end user is using a keyboard, the &lt;code class=&quot;markup&quot;&gt;onChange&lt;/code&gt;
 event handler is executed for every item within the list. It is 
impossible for the user to directly select the last item in the list, as
 each previous item within the list will trigger the page change. The 
only way the user can select the last menu item is by navigating to the 
page for the first item in the list, then pressing the &lt;span class=&quot;menuchoice&quot;&gt;Back&lt;/span&gt; button, navigating to the second item, then pressing the &lt;span class=&quot;menuchoice&quot;&gt;Back&lt;/span&gt; button, and so forth until the last menu item is accessed.&lt;br /&gt;

    &lt;/div&gt;
&lt;div class=&quot;section&quot; tabindex=&quot;-1&quot;&gt;

     &lt;h3&gt;
Solutions&lt;/h3&gt;
Rather than using the &lt;code class=&quot;markup&quot;&gt;onChange&lt;/code&gt; event
 handler, allow the user to select the item from a list then select a 
button or submit the form to activate the script. When server-side 
scripting is used to process the form information and redirect the 
browser accordingly, there is no need for JavaScript at all. The 
following code demonstrates one method of fixing the &lt;code class=&quot;markup&quot;&gt;onChange&lt;/code&gt; problem.&lt;br /&gt;


     Select a page using the drop-down menu then select the &lt;span class=&quot;menuchoice&quot;&gt;Go!&lt;/span&gt; button. Click on the &lt;span class=&quot;menuchoice&quot;&gt;Back&lt;/span&gt; button in the browser to return to this page.&lt;br /&gt;


     &lt;form action=&quot;media/generic_link.htm&quot;&gt;

      &lt;label for=&quot;selectPage2&quot;&gt;Go to:&lt;/label&gt; 
       

       

       

       
       &lt;br /&gt;

     &lt;/form&gt;
&lt;div class=&quot;programlisting&quot;&gt;

      &lt;code class=&quot;markup&quot;&gt;
      &amp;lt;form action=&quot;page.htm&quot; onsubmit=&quot;return false;&quot;&amp;gt;&lt;br /&gt; 
      &amp;lt;p&amp;gt;&amp;lt;label for=&quot;selectPage2&quot;&amp;gt;Go to:&amp;lt;/label&amp;gt;&lt;br /&gt;   
      &amp;lt;select name=&quot;selectPage2&quot; id=&quot;selectPage2&quot;&amp;gt;&lt;br /&gt;   
      &amp;lt;option value=&quot;&quot;&amp;gt;Select a page:&amp;lt;/option&amp;gt;&lt;br /&gt;   
      &amp;lt;option value=&quot;page.htm&quot;&amp;gt;Page 1&amp;lt;/option&amp;gt;&lt;br /&gt;   
      &amp;lt;option value=&quot;page.htm&quot;&amp;gt;Page 2&amp;lt;/option&amp;gt;&lt;br /&gt;   
      &amp;lt;option value=&quot;page.htm&quot;&amp;gt;Page 3&amp;lt;/option&amp;gt;&lt;br /&gt;   
      &amp;lt;/select&amp;gt;&lt;br /&gt;   
      &amp;lt;input type=&quot;button&quot; value=&quot;Go!&quot; &lt;strong&gt;onclick&lt;/strong&gt;=&quot;goto_URL(this.form.selectPage2);&quot; /&amp;gt;&lt;br /&gt; 
      &amp;lt;/p&amp;gt;&lt;br /&gt;
      &amp;lt;/form&amp;gt;&lt;br /&gt;
      &lt;/code&gt;
     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;deviceindependent&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Using Device Independent Event Handlers&lt;/h2&gt;
As mentioned previously, several event handlers are device independent, including &lt;code class=&quot;markup&quot;&gt;onFocus&lt;/code&gt;, &lt;code class=&quot;markup&quot;&gt;onBlur&lt;/code&gt;, &lt;code class=&quot;markup&quot;&gt;onSelect&lt;/code&gt;, &lt;code class=&quot;markup&quot;&gt;onChange&lt;/code&gt;, and &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; (when &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt;
 is used with link or form elements). When possible, use device 
independent event handlers. Other event handlers are device dependent, 
meaning that they rely wholly upon a certain type of input. For 
instance, &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt;, &lt;code class=&quot;markup&quot;&gt;onMouseOut&lt;/code&gt;, and &lt;code class=&quot;markup&quot;&gt;onDblClick&lt;/code&gt; rely upon the use of a mouse. There are also some event handlers that are dependent upon use of the keyboard (&lt;code class=&quot;markup&quot;&gt;onKeyDown&lt;/code&gt;, &lt;code class=&quot;markup&quot;&gt;onKeyUp&lt;/code&gt;,
 etc.). Multiple device dependent event handlers can be used together to
 allow both mouse and keyboard activation of JavaScript. For instance, 
both &lt;code class=&quot;markup&quot;&gt;onMouseOver&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onFocus&lt;/code&gt; (as well as &lt;code class=&quot;markup&quot;&gt;onMouseOut&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onBlur&lt;/code&gt;)
 can be used to provide both keyboard and mouse activation of a script. 
Using multiple device dependent event handlers together as a method of 
implementing device independence requires a great deal of testing across
 different browsers and assistive technologies to ensure that 
accessibility is not limited in any way.&lt;br /&gt;
&lt;div class=&quot;section&quot; id=&quot;dhtml&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Dynamic &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; and Accessibility&lt;/h2&gt;
Dynamic &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; (&lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt;) is typically a combination of Cascading Style Sheets (&lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;) and JavaScript. &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt;
 allows developers to display, hide, or move information based upon 
input from the user or pre-programmed commands. Many of the examples in 
this section have used &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt;. Most drop-down or fly-out menu systems found on Web pages also use &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt;. Because most of these &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt; elements are modified based upon mouse input, they are typically inaccessible to users who do not use a mouse. When &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt; is used, two items must be evaluated to determine its impact on accessibility:&lt;br /&gt;


   &lt;ol&gt;
&lt;li&gt;Is the event used to trigger a change device independent? If the mouse is required, then it is not fully accessible.&lt;/li&gt;
&lt;li&gt;Is the &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt; content or functionality itself accessible? If assistive technologies cannot adequately access &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt; triggered content or functionality, then it is not fully accessible.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;write&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Using &lt;code class=&quot;markup&quot;&gt;document.write&lt;/code&gt;&lt;/h2&gt;
Dynamic, constantly changing information is being written to the page in this example using the &lt;code class=&quot;markup&quot;&gt;document.write&lt;/code&gt;
 command in JavaScript. In most cases, content that is written to the 
page using JavaScript is accessible to assistive technologies. However, 
if the dynamic content is constantly changing or otherwise interferes 
with navigation or browser functionality, then it may cause 
accessibility problems.&lt;br /&gt;


   &lt;div class=&quot;section&quot; id=&quot;dwe&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
&lt;code class=&quot;markup&quot;&gt;document.write&lt;/code&gt; example&lt;/h3&gt;
The current time is displayed in the text box below. It updates and changes every second.&lt;br /&gt;


    &lt;form action=&quot;&quot;&gt;

     &lt;label for=&quot;face&quot;&gt;The current time is:&lt;/label&gt; &lt;input id=&quot;face&quot; size=&quot;13&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;&lt;br /&gt;


     &lt;div class=&quot;section&quot; id=&quot;prob_time&quot; tabindex=&quot;-1&quot;&gt;

      &lt;h4&gt;
Problems&lt;/h4&gt;
In this case, because the content is constantly changing and 
refreshing, a screen reader would not be able to read it and it may 
cause some confusion.&lt;br /&gt;

     &lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;solution_time&quot; tabindex=&quot;-1&quot;&gt;

      &lt;h4&gt;
Solutions&lt;/h4&gt;
When using dynamic information, you must first ask yourself if 
it is necessary and vital to the function or content of the page. If so,
 there is often a way to provide the content without using inaccessible 
JavaScript. For instance, you could write the current time to the page 
when it loads using a server-side script. Though it will not be 
constantly updating, it may suffice. You may also have the user select a
 link or button to go to another page that displays the current time 
from server side processing. Another approach that uses a more 
accessible implementation of JavaScript would be to provide a link or 
button that allows the user to display the current time at their 
request.&lt;br /&gt;


      

      &lt;div class=&quot;programlisting&quot;&gt;

       &lt;code class=&quot;markup&quot;&gt;
&amp;lt;input type=&quot;button&quot; &lt;br /&gt;
value=&quot;Display the current time&quot;
&lt;br /&gt;
onclick=&quot;alert(&#39;The current time is &#39; + timeValue);&quot; /&amp;gt;&lt;/code&gt;      &lt;/div&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;popups&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Pop-up Windows&lt;/h2&gt;
Pop-up windows provide a unique accessibility problem. First of 
all, most usability experts would argue against the use of pop-up 
windows except in the most extreme of cases. If you must use pop-up 
windows, know that they introduce several very unique accessibility 
issues. For a visual user, it may be difficult to notice and navigate to
 the new window. For someone who is using assistive technologies, the 
new window may be annoying and confusing because the default behavior 
for the link has been modified. JavaScript implementation may make the 
new window difficult or impossible to resize or scale for someone using a
 screen enlarger. For someone who is blind, there is typically no 
indication that they are presently navigating in a new window. When the 
screen reader user attempts to return to the previous page by selecting 
the back button, it may be confusing to find that this does not work.&lt;br /&gt;


   &lt;div class=&quot;section&quot; id=&quot;puex&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
Pop-up example&lt;/h3&gt;
&lt;a href=&quot;http://webaim.org/techniques/javascript/media/popup.htm&quot;&gt;Select this link to open a new window&lt;/a&gt;&lt;br /&gt;


    &lt;div class=&quot;programlisting&quot;&gt;

     &lt;code class=&quot;markup&quot;&gt;
&amp;lt;a href=&quot;popup.htm&quot; &lt;br /&gt;
onclick=&quot;window.open(this.href); return false;&quot;&amp;gt;Select this...&amp;lt;/a&amp;gt;&lt;/code&gt;     &lt;/div&gt;
&lt;div class=&quot;note&quot;&gt;

     &lt;span class=&quot;title&quot;&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;


     If you are using software to block pop-up windows, you may need 
disable the software or select the link in a way that bypasses the 
pop-up blocker (typically &lt;strong&gt;&lt;span class=&quot;keycombo&quot;&gt;&lt;span class=&quot;keycap&quot;&gt;Ctrl&lt;/span&gt; + click&lt;/span&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;span class=&quot;keycombo&quot;&gt;&lt;span class=&quot;keycap&quot;&gt;Ctrl&lt;/span&gt; + &lt;span class=&quot;keycap&quot;&gt;Enter&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt; with the link selected).&lt;br /&gt;

    &lt;/div&gt;
In the example code above, the link will continue to work normally (i.e., in the same browser window) if JavaScript is disabled.&lt;br /&gt;


    
      When using JavaScript to open new windows, you can modify the size and 
        position of the new window. You can also add or remove functionality of 
        the window, such as the ability to resize, display scroll bars, show tool 
        bars, etc. Be very careful when changing the default behavior of the browser 
        window. If a user has low vision and must enlarge the content, a small 
        window that cannot be enlarged and does not display scroll bars would 
        be very inaccessible. Someone with a motor disability may rely upon large 
        tool bars to accurately control the web browser, so removing or modifying 
        them may introduce difficulties for this user.&lt;br /&gt;


    As you can see, there are many difficulties in both usability and
 accessibility that arise through the use of pop-up windows. Care must 
be taken in making the decision to use them. If they are used, thorough 
user testing of your implementation is vital to ensure accessibility. &lt;em&gt;Always alert the user to the fact that a pop-up window will be opened.&lt;/em&gt;&lt;br /&gt;

   &lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;redirecting&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Redirecting and Refreshing Browser Windows&lt;/h2&gt;
When the page the browser is viewing suddenly changes or 
refreshes, the person viewing that page may become disoriented or 
confused, especially if that person is using an assistive technology. 
This is commonly done with page redirects when page content has been 
moved or updated. Section 508 requires that users be given control over 
time sensitive content changes. Do not automatically change or refresh 
the browser window without first alerting the user that the change will 
occur and giving him/her the ability to disable or postpone the change.&lt;br /&gt;

  &lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;css&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Using Pure &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; as a JavaScript Alternative&lt;/h2&gt;
As mentioned previously, Cascading Style Sheet (&lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;) parameters are often modified using JavaScript to create dynamically changing &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt; pages. However, with the advent of &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; version 2, much of the dynamic functionality available with JavaScript is now contained within the specifications for &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;
 itself. This allows the construction of interactive and dynamic 
navigation and layout elements without the need for JavaScript events. 
You can create drop-down menus, interactive images, and other exciting 
features in Web sites without worrying about device dependent event 
handlers. However, the new &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; standards are not fully supported in modern browsers, namely Internet Explorer.&lt;br /&gt;


   
    Also, screen readers do not have great &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; 
      support, especially when presented with content that can be made visible 
      or invisible using either the &lt;code class=&quot;markup&quot;&gt;display:none&lt;/code&gt; or 
      &lt;code class=&quot;markup&quot;&gt;visibility:hidden&lt;/code&gt; styles. Many screen readers 
      do not read content that is assigned these styles even though the content 
      is still part of the underlying structure of the page. Until there is better 
      &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; support in both web 
      browsers and assistive technologies, using &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; 
      alone to produce dynamic content should only employed with much testing 
      in a variety of browsers and screen readers.&lt;br /&gt;
&lt;div class=&quot;section&quot; id=&quot;intro&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Introduction&lt;/h2&gt;
Whenever JavaScript cannot be made directly accessible, an accessible alternative 
      must be provided. Also, many user agents, such as web-enabled cell phones 
      and &lt;acronym title=&quot;Personal Digital Assistant&quot;&gt;PDA&#39;s&lt;/acronym&gt;, do not 
      yet utilize JavaScript. There are several ways you can provide accessible 
      alternatives when the scripting cannot be made accessible or when the end 
      user does not have JavaScript enabled.&lt;br /&gt;

  &lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;serverside&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Server-side Processing&lt;/h2&gt;
In many cases, the functionality provided by JavaScript can be duplicated 
      by server-side scripting. For example, JavaScript is often used to validate 
      form elements before a form is posted. Instead of implementing such JavaScript 
      programming and its accompanying accessibility techniques, you could use 
      a server-side script to validate the form elements. JavaScript is often 
      used to write dynamic information to a web page, such as the current date 
      and/or time. Again, using a server script or server-side include negates 
      the need for additional accessibility implementation.&lt;br /&gt;

  &lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;noscript&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Using the &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; Element&lt;/h2&gt;
Making JavaScript natively accessible is very important. However, 
in some cases, the end user may not have JavaScript enabled or may be 
using technologies that do not support JavaScript (e.g., cell phone, &lt;acronym title=&quot;Personal Digital Assistant&quot;&gt;PDA&lt;/acronym&gt;,
 etc.). In such cases, you can provide non-JavaScript alternatives to 
user&#39;s who cannot or choose not to view JavaScript content.&lt;br /&gt;


   When JavaScript is used within a Web page, the most 
straightforward way to provide an alternative for the 
JavaScript-generated content is to provide content within the &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; element. The &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt;
 element can be used within your page to display content in browsers 
that do not support or have disabled JavaScript. However, if JavaScript 
IS enabled the &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; element is ignored.&lt;br /&gt;


   &lt;div class=&quot;important&quot;&gt;

    &lt;span class=&quot;title&quot;&gt;&lt;strong&gt;Important&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;


    Providing an accessible alternative within the &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; element for an inaccessible script will not make the page accessible. The &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt;
 content will only display if JavaScript is disabled. Most screen reader
 users have JavaScript enabled, and will thus encounter your 
inaccessible script and not the &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; content.&lt;br /&gt;

   &lt;/div&gt;
The &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; element provides 
alternative text for the JavaScript. If the content or functionality of 
the script needs an accessible alternative when JavaScript is disabled, 
then you need &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt;. The &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt;
 content should ideally contain the equivalent content or functionality 
that is provided by the script. However, this is often not possible. It 
is not sufficient to simply indicate, &quot;Your browser does not support 
JavaScript.&quot; This does nothing to make the content accessible. You may, 
for example, provide a link to an accessible &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt;
 alternative or to a page that utilizes server-side scripting instead. 
Or, at very least, describe the type of content that would be displayed 
if JavaScript were enabled.&lt;br /&gt;


   &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; should be used anytime alternative or non-javascript content or functionality is required.&lt;br /&gt;


   &lt;div class=&quot;programlisting&quot;&gt;

    &lt;code class=&quot;markup&quot;&gt;
    &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;  
    &amp;lt;!-- document.write(&quot;The current time is &quot; + currenttime) --&amp;gt;&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
    &lt;strong&gt;&amp;lt;noscript&amp;gt;&lt;/strong&gt;&lt;br /&gt;  
    &amp;lt;!-- link to page that displays time from server-side script --&amp;gt;&lt;br /&gt;  
    &amp;lt;a href=&quot;time.htm&quot;&amp;gt;View the current time&amp;lt;/a&amp;gt;&lt;br /&gt;
    &lt;strong&gt;&amp;lt;/noscript&amp;gt;&lt;/strong&gt;&lt;br /&gt;
    &lt;/code&gt;
   &lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;ex1&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
&lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; example&lt;/h3&gt;
In the following example, two form buttons are provided within the &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; code. If you have JavaScript enabled, the &lt;code class=&quot;markup&quot;&gt;document.write&lt;/code&gt; command within the &lt;code class=&quot;markup&quot;&gt;&amp;lt;script&amp;gt;&lt;/code&gt;
 element will display the first button. If this button is selected, it 
triggers a JavaScript function that may be used to validate and submit 
the form using additional JavaScript within the page. If JavaScript is 
not enabled, then the button contained within the &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt;
 element is displayed, which could submit the form to a server-side 
processing script, which would provide the form validation and feedback.&lt;br /&gt;


    &lt;form action=&quot;alternatives&quot; id=&quot;noscriptform&quot;&gt;

     &lt;label for=&quot;username&quot;&gt;Username:&lt;/label&gt; &lt;input id=&quot;username&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;


     
    &lt;/form&gt;
&lt;div class=&quot;programlisting&quot;&gt;

     &lt;code class=&quot;markup&quot;&gt;
     &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;   
     &amp;lt;!--&lt;br /&gt;  
     document.write(&#39;&amp;lt;input type=&quot;button&quot; value=&quot;Submit&quot; onclick=&quot;validateForm();&quot; /&amp;gt;&#39;);&lt;br /&gt;   
     --&amp;gt;&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &lt;strong&gt;&amp;lt;noscript&amp;gt;&lt;br /&gt;
&lt;/strong&gt;&amp;lt;p&amp;gt;&lt;br /&gt; 
&amp;lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&amp;gt;&lt;br /&gt;  
&amp;lt;/p&amp;gt;&lt;strong&gt;&lt;br /&gt;
&amp;lt;/noscript&amp;gt;&lt;/strong&gt;&lt;br /&gt;
     &lt;/code&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;section&quot; id=&quot;overview&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Overview&lt;/h2&gt;
JavaScript allows developers to add increased interaction, information 
      processing, and control in web-based content. JavaScript can also cause 
      accessibility problems by limiting navigation using a keyboard or assistive 
      technology, presenting content or functionality that is not accessible to 
      assistive technologies, limiting user control over automated content changes, 
      and modifying the normal functionality of the browser. When faced with JavaScript 
      accessibility issues, you must do one of the following:&lt;br /&gt;


   &lt;ul&gt;
&lt;li&gt;Ensure the JavaScript is directly accessible&lt;/li&gt;
&lt;li&gt;Provide an accessible, non-JavaScript alternative&lt;/li&gt;
&lt;/ul&gt;
JavaScript is often used to make cosmetic or other content changes
 that do not affect accessibility. Content written to the page using 
JavaScript is accessible if:&lt;br /&gt;


   &lt;ul&gt;
&lt;li&gt;Device independent event handlers are used.&lt;/li&gt;
&lt;li&gt;JavaScript enabled content and functionality is accessible to assistive technologies.&lt;/li&gt;
&lt;li&gt;Scripted pages and elements are navigable using a keyboard.&lt;/li&gt;
&lt;li&gt;The normal browser functionality is not modified in a way that may cause confusion or inaccessibility.&lt;/li&gt;
&lt;li&gt;An accessible alternative is provided when JavaScript cannot be made natively accessible.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;jseh&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
JavaScript Event Handlers&lt;/h2&gt;
There are two types of JavaScript event handlers - device 
dependent and device independent. When implementing event handlers, you 
must either use a device independent event handler or use multiple 
device dependent event handlers to accommodate all users. Below is a 
list of common event handlers and their associated accessibility issues.&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code class=&quot;markup&quot;&gt;&lt;strong&gt;onMouseOver&lt;/strong&gt;&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;&lt;strong&gt;onMouseOut&lt;/strong&gt;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Device dependent (require the use of a mouse)&lt;/dd&gt;&lt;dd&gt;Ensure important content or functionality is not introduced with these event handlers&lt;/dd&gt;&lt;dd&gt;Use in conjunction with the &lt;code class=&quot;markup&quot;&gt;onFocus&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onBlur&lt;/code&gt; event handlers to allow keyboard accessibility&lt;/dd&gt;&lt;dd&gt;Provide an accessible alternative if the content or functionality cannot be made natively accessible&lt;/dd&gt;
&lt;dt&gt;&lt;code class=&quot;markup&quot;&gt;&lt;strong&gt;onFocus&lt;/strong&gt;&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;&lt;strong&gt;onBlur&lt;/strong&gt;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Device independent (work with both keyboard and mouse)&lt;/dd&gt;&lt;dd&gt;Test to ensure that accessibility is not affected&lt;/dd&gt;
&lt;dt&gt;&lt;code class=&quot;markup&quot;&gt;&lt;strong&gt;onClick&lt;/strong&gt;&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;&lt;strong&gt;onDblClick&lt;/strong&gt;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Device dependent (require the use of a mouse)&lt;/dd&gt;&lt;dd&gt;&lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; is activated by keyboard input when used with links and form elements&lt;/dd&gt;&lt;dd&gt;There are no device independent or keyboard accessible equivalents to these event handlers&lt;/dd&gt;&lt;dd&gt;Functionality and content provide by the &lt;code class=&quot;markup&quot;&gt;onClick&lt;/code&gt; event handler must also be made accessible&lt;/dd&gt;
&lt;dt&gt;&lt;code class=&quot;markup&quot;&gt;&lt;strong&gt;onChange&lt;/strong&gt;&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;&lt;strong&gt;onSelect&lt;/strong&gt;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Device independent (work with both keyboard and mouse)&lt;/dd&gt;&lt;dd&gt;Functionality and content provide by the &lt;code class=&quot;markup&quot;&gt;onChange&lt;/code&gt; and &lt;code class=&quot;markup&quot;&gt;onSelect&lt;/code&gt; event handlers must also be made accessible&lt;/dd&gt;&lt;dd&gt;Drop-down menu navigation items that are triggered with &lt;code class=&quot;markup&quot;&gt;onChange&lt;/code&gt; are not fully keyboard accessible&lt;/dd&gt;&lt;/dl&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;dhtml&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Dynamic &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; and Accessibility&lt;/h2&gt;
Dynamic &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; (&lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt;) is a combination of JavaScript and Cascading Style Sheets (&lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;). By its very nature, &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt; can present dynamically changing content. &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt; is often triggered by user interactions, such as moving the mouse. When implementing &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt;, you must ensure that the &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt; is triggered in a device independent way and that the content and functionality provided by the &lt;acronym title=&quot;Dynamic HyperText Markup Language&quot;&gt;DHTML&lt;/acronym&gt; is also accessible.&lt;br /&gt;


   
    JavaScript can also be used to write dynamic content to the web page. In 
      most cases, this content is accessible, unless the content is constantly 
      changing or is in any other way interfering with accessibility of the page.&lt;br /&gt;

  &lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;puw&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Pop-up Windows&lt;/h2&gt;
The default behavior of the web browser and certain &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; 
      elements can also be affected by JavaScript. Pop-up windows can be triggered 
      by JavaScript or by JavaScript event handlers. If the user is not alerted 
      to the fact that a pop-up window is opening, they may become confused or 
      disoriented by the unnatural behavior of the Web browser. Further modification 
      of browser windows to remove scroll bars, status bars, menu bars, or tool 
      bars may also cause accessibility problems. Use pop-up windows with care 
      and if they are used, always alert the user to this fact. The user must 
      also be alerted when JavaScript is used to automatically perform browser 
      functions, such as redirecting, refreshing, or automatic scrolling. In all 
      cases, user testing and testing with assistive technologies can provide 
      valuable feedback regarding accessibility of specific JavaScript implementations.&lt;br /&gt;

  &lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;jsa&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
JavaScript Alternatives&lt;/h2&gt;
There are many ways to provide alternatives to JavaScript. Newer versions of &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; allow much of the behavior of JavaScript to be replicated using &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;
 alone. Drop-down menus, navigation bars, and interactive images can all
 be developed without relying on JavaScript. However, the implementation
 of &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; across 
browsers and assistive technologies is varied and problematic. When 
JavaScript itself cannot be made natively accessible, you must provide 
an accessible alternative. This can be done by replicating or replacing 
the JavaScript behavior with server-side processing. You can also 
provide &lt;code class=&quot;markup&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; content which will be accessible when JavaScript is disabled or not available to the end user.&lt;br /&gt;

  &lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;standards1&quot; tabindex=&quot;-1&quot;&gt;

   &lt;h2&gt;
Standards and Guidelines&lt;/h2&gt;
The following standards and guidelines apply to JavaScript:&lt;br /&gt;


   &lt;div class=&quot;section&quot; id=&quot;sect508&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
Section 508 of the Rehabilitation Act §1194.22:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;(l): When pages utilize scripting languages to display content,
 or to create interface elements, the information provided by the script
 shall be identified with functional text that can be read by assistive 
technology.&lt;/li&gt;
&lt;li&gt;(n) When electronic forms are designed to be completed on-line,
 the form shall allow people using assistive technology to access the 
information, field elements, and functionality required for completion 
and submission of the form, including all directions and cues.&lt;/li&gt;
&lt;li&gt;(p) When a timed response is required, the user shall be alerted and given sufficient time to indicate more time is required.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; id=&quot;wcag&quot; tabindex=&quot;-1&quot;&gt;

    &lt;h3&gt;
W3C Web Content Accessibility Guidelines (&lt;acronym title=&quot;Web Content Accessibility Guidelines&quot;&gt;WCAG&lt;/acronym&gt;) 1.0:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;6.3 (Priority 1): Ensure that pages are usable when scripts, 
applets, or other programmatic objects are turned off or not supported. 
If this is not possible, provide equivalent information on an 
alternative accessible page.&lt;/li&gt;
&lt;li&gt;6.4 (Priority 2): For scripts and applets, ensure that event handlers are input device-independent.&lt;/li&gt;
&lt;li&gt;6.5 (Priority 2): Ensure that dynamic content is accessible or provide an alternative presentation or page.&lt;/li&gt;
&lt;li&gt;7.4 (Priority 2): Until user agents provide the ability to stop the refresh, do not create periodically auto-refreshing pages.&lt;/li&gt;
&lt;li&gt;7.5 (Priority 2): Until user agents provide the ability to stop
 auto-redirect, do not use markup to redirect pages automatically. 
Instead, configure the server to perform redirects.&lt;/li&gt;
&lt;li&gt;8.1 (Priority 2): Make programmatic elements such as scripts 
and applets directly accessible or compatible with assistive 
technologies.&lt;/li&gt;
&lt;li&gt;10.1 (Priority 2): Until user agents allow users to turn off 
spawned windows, do not cause pop-ups or other windows to appear and do 
not change the current window without informing the user.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;


   

   
  
 &lt;/div&gt;
&lt;br /&gt;

  &lt;/div&gt;
&lt;br /&gt;

 &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/4534945487493065362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/4534945487493065362' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/4534945487493065362'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/4534945487493065362'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/creating-accessible-javascript.html' title='Creating Accessible JavaScript'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-7428272264029432707</id><published>2012-01-02T00:19:00.001-08:00</published><updated>2012-01-02T00:19:35.245-08:00</updated><title type='text'>Getting Sourcey — native HTML5 Audio and video</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hard perhaps to believe, but the world wide web began without an 
image element. That’s right, there was no way to include images as part 
of the content of a web page before Mosaic implemented them (here’s &lt;a href=&quot;http://1997.webhistory.org/www.lists/www-talk.1993q1/0182.html&quot;&gt;Marc Andreesen proposing the img element&lt;/a&gt; at the beginning of 1993). The &lt;code&gt;img&lt;/code&gt; element ushered in the age of included content so the web browsers could now display gif, jpeg, and more recently &lt;span class=&quot;caps&quot;&gt;PNG&lt;/span&gt; format images in a standard way, but that’s where matters stayed for more than a decade. While the non-​​standard &lt;code&gt;embed&lt;/code&gt; element (ironically, now standardized in &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;, and later standardized &lt;code&gt;object&lt;/code&gt;
 element enabled developers to include audio, video, and interactive 
content, browsers did not implement native handling of these kinds of 
media — the actual rendering was left to plugins, like Flash (while the 
number of different commonly used plugins today is quite low, in the 
late 1990s there was an explosion of different plug in technologies.)&lt;br /&gt;
While &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; for the first time specifies a way of incorporating audio and video content via the mundanely named &lt;code&gt;audio&lt;/code&gt; and &lt;code&gt;video&lt;/code&gt;
 elements, the revolution in web content these bring is that browsers 
now no longer require plugins to play the content, rather they do so 
“natively”. Which has the advantage that users don’t need to download 
and install plugins, or keep them up to date. But there’s more to it 
than that. With plugin content, browsers effectively hand over a part of
 the browser window and say to the plugin — “ok, this is all yours, do 
your worst”. Which makes applying style to a video player (rounded 
corners, or adding a drop shadow, for instance) challenging, and effects
 like layering &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; based content over the top of plugin content a bit of a lottery.&lt;br /&gt;
&lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; audio and video has been, in browser years, quickly adopted by all major browsers (we’ll &lt;a href=&quot;http://www.webdirections.org/blog/getting-sourcey-native-html5-audio-and-video/#support&quot;&gt;cover off browser support in just a moment&lt;/a&gt;). But let’s first take a look at how we incorporate audio and video content into &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;
 documents, how to provide fallbacks for browsers which don’t support 
them, and the inevitable gotchas. And once again, I’ll introduce a 
couple of tools we’ve developed to make life easier for you when using 
native multimedia content in your web sites and applications.&lt;br /&gt;
There
 are a lot of great resources out there, which go into much more detail 
on some aspects we only really touch on here, particularly on the 
complex issue of formats and codecs, as well as the challenges of making
 your content accessible. There’s a list of &lt;a href=&quot;http://www.webdirections.org/blog/getting-sourcey-native-html5-audio-and-video/#reading&quot;&gt;further reading&lt;/a&gt; at the end of the article.&lt;br /&gt;
We’ll begin by looking at audio, and then follow up with video, which we use in almost exactly the same way as audio.&lt;br /&gt;
&lt;h3&gt;
&lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Audio&lt;/h3&gt;
&lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; introduces the &lt;code&gt;audio&lt;/code&gt; element, for embedding audio files in a page. Browsers which support &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;
 audio provide a simple audio player for playing, scrubbing forward and 
back through content, as well as setting the volume. It’s also possible 
to hide these controls, and either autoplay files, or build your own 
player interface using &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; and the audio element’s JavaScript &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; (which is beyond the scope of this article, but not really that difficult at all if you are competent in JavaScript).&lt;br /&gt;
&lt;h4&gt;
Setting up the element&lt;/h4&gt;
The first thing we need to do to include audio in a page is to add an &lt;code&gt;audio&lt;/code&gt; element to the &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;. Unlike &lt;code&gt;img&lt;/code&gt;, audio is a non empty element — that is it can contain other &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;, so has an opening and closing tag.&lt;br /&gt;
&lt;pre&gt;&amp;lt;audio&amp;gt;&amp;lt;/audio&amp;gt;&lt;/pre&gt;
Of course, this isn’t going to play anything, just as an &lt;code&gt;img&lt;/code&gt; element with no &lt;code&gt;src&lt;/code&gt; attribute won’t display an image. So, you’re probably guessing we add the audio file reference using a &lt;code&gt;src&lt;/code&gt; attribute. And you’re more or less right. We &lt;strong&gt;can&lt;/strong&gt; do that, but there is another, better way to add a reference to the sound files we want to play. This is because the &lt;code&gt;audio&lt;/code&gt; element can have only one &lt;code&gt;src&lt;/code&gt;
 attribute, but because different browsers support different audio 
formats, at least for now, and for the foreseeable future, we’ll need to
 provide browsers with multiple sound files, so that we cover all 
browser bases. We’ll turn to how we do this in a moment, but let’s first
 look at several other attributes the audio element can take.&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;controls&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;The &lt;code&gt;controls&lt;/code&gt;
 attribute, when present, tells a browser to display the default 
controls for its audio player. If the attribute is not present, then no 
controls will be displayed.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;loop&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;another boolean attribute, if this is present, the audio file will begin again after it has played indefinitely&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;autoplay&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;if this attribute is present, then once the sound file can begin playing, it will. &lt;code&gt;autoplay&lt;/code&gt; should be used carefully and sparingly!&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;autobuffer&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;this is now replaced with the &lt;code&gt;preload&lt;/code&gt; attribute which we’ll look at in a moment, but as older browsers, for example Safari 4 support &lt;code&gt;autobuffer&lt;/code&gt; instead of &lt;code&gt;preload&lt;/code&gt;,
 you may wish to add this attribute as well if you want audio to be 
buffered by the browser as soon as a page is loaded. Browsers may choose
 to ignore this, or not support it at all (Opera for example doesn’t 
support preloading of audio)&lt;/dd&gt;&lt;/dl&gt;
Before we continue, these attributes are &lt;em&gt;boolean&lt;/em&gt;
 attributes, which you might not necessarily be as familiar with as you 
are regular attributes. Boolean attributes (another exampled is &lt;code&gt;checked&lt;/code&gt;) are either true, or false, depending on whether they are present or absent on an element. So, they look like this&lt;br /&gt;
&lt;pre&gt;&amp;lt;audio controls loop&amp;gt;&amp;lt;/audio&amp;gt;&lt;/pre&gt;
That is, they don’t take values. If this offends your &lt;span class=&quot;caps&quot;&gt;XHTML&lt;/span&gt; sensibilities, they can also be written like so&lt;br /&gt;
&lt;pre&gt;&amp;lt;audio controls=&quot;controls&quot; loop=&quot;loop&quot;&amp;gt;&amp;lt;/audio&amp;gt;&lt;/pre&gt;
That is, with their name as their value as well. Why they aren’t written as controls=“true” is beyond me, but there you have it.&lt;br /&gt;
In addition to these boolean attributes, and the &lt;code&gt;src&lt;/code&gt; attribute (which we’ve recommended ignoring) &lt;code&gt;audio&lt;/code&gt; can also take the &lt;code&gt;preload&lt;/code&gt; attribute, which has one of three values. The &lt;code&gt;preload&lt;/code&gt; attribute doesn’t &lt;em&gt;force&lt;/em&gt;
 the browser to preload an audio file, but rather, suggests to the 
browser how it can provide the best user experience to the user 
(balancing the impact of downloading a potentially large file, with the 
benefit of faster response to their choosing to play a file). In the 
words of the specification, these values are&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;none&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Hints
 to the user agent that either the author does not expect the user to 
need the media resource, or that the server wants to minimise 
unnecessary traffic.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;metadata&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Hints to the 
user agent that the author does not expect the user to need the media 
resource, but that fetching the resource metadata (dimensions, first 
frame, track list, duration, etc) is reasonable.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;auto&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Hints
 to the user agent that the user agent can put the user’s needs first 
without risk to the server, up to and including optimistically 
downloading the entire resource.&lt;/dd&gt;&lt;/dl&gt;
&lt;h4&gt;
Getting Sourcey&lt;/h4&gt;
Having suggested we don’t use the &lt;code&gt;src&lt;/code&gt; attribute to link to the audio file to be played, how then &lt;em&gt;can&lt;/em&gt; we do this? Well, we saw audio elements can contain other &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; elements, and in this case, we’re going to use the &lt;code&gt;source&lt;/code&gt; element (also new in &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;),
 to provide links to one or more audio files in various formats. The 
browser can then download the format it supports, ignoring others to 
save bandwidth.&lt;br /&gt;
Like &lt;code&gt;img&lt;/code&gt;, the &lt;code&gt;source&lt;/code&gt; element uses the &lt;code&gt;src&lt;/code&gt; attribute to link to a file. So, if we want to link to an mp3 file, we do so like this&lt;br /&gt;
&lt;pre&gt;&amp;lt;source src=&quot;http://westciv.com/podcasts/youmayknowmypoetry.mp3&quot;&amp;gt;&lt;/pre&gt;
and, if we put that all together, that’s all we need to play this file in browsers which support mp3 (at present, &lt;span class=&quot;caps&quot;&gt;IE9&lt;/span&gt;, Safari, Chrome, Android and iOS).&lt;br /&gt;
&lt;pre&gt;&amp;lt;audio controls=&quot;controls&quot; loop=&quot;loop&quot;&amp;gt;
 &amp;lt;source src=&quot;http://westciv.com/podcasts/youmayknowmypoetry.mp3&quot;&amp;gt;
&amp;lt;/audio&amp;gt;&lt;/pre&gt;
While several browsers will be able to play this 
content, neither Firefox nor Opera support the mp3 format natively. They
 both however, support the Ogg Vorbis format, so in addition, we’ll link
 to an ogg version of this same audio file, for the benefit of users of 
these browsers.&lt;br /&gt;
&lt;pre&gt;&amp;lt;audio controls=&quot;controls&quot; loop=&quot;loop&quot;&amp;gt;
 &amp;lt;source src=&quot;http://westciv.com/podcasts/youmayknowmypoetry.mp3&quot;&amp;gt;
 &amp;lt;source src=&quot;http://westciv.com/podcasts/youmayknowmypoetry.ogg&quot;&amp;gt;
&amp;lt;/audio&amp;gt;&lt;/pre&gt;
Where a browser happens to support both ogg and 
mp3, it will use the first source it finds which it supports, and so in 
this case, play the mp3 version.&lt;br /&gt;
So now we have an audio element, 
with two sources, which provide audio that can be played in all modern 
browsers. But what about older browsers? Can we also include support for
 them? &lt;a href=&quot;http://www.webdirections.org/blog/getting-sourcey-native-html5-audio-and-video/#audio-fallbacks&quot;&gt;Let’s find out&lt;/a&gt;.&lt;br /&gt;
As
 an aside, beneath the seemingly simple issue of audio and video 
formats, there’s more than a little complexity. We’ll look at this whole
 issue separately in the &lt;a href=&quot;http://www.webdirections.org/blog/getting-sourcey-native-html5-audio-and-video/#gotchas&quot;&gt;gotchas&lt;/a&gt; section, but I’ll just note here, that we can give the browser further information about the file, including it’s &lt;span class=&quot;caps&quot;&gt;MIME&lt;/span&gt; type, and a specific codec to be used to decode it using the &lt;code&gt;type&lt;/code&gt;
 attribute. This can further help a browser in deciding whether to 
download a file — audio and video files are typically large, so browsers
 really should only download files they can very likely play. For now, 
just note we have the type attribute, which may be useful, for example, 
to distinguish between audio files of the same format encoded at 
different bitrates.&lt;br /&gt;
&lt;h4 id=&quot;audio-fallbacks&quot;&gt;
Providing fallbacks&lt;/h4&gt;
Because
 we’ve long been able to embed audio and video in a web page using Flash
 (or Silverlight, and other audio playing plugin technologies), we can 
use this to provide a fallback player for audio content. There’s two 
approaches to this (for simplicity, we’ll only consider the case of 
Flash, but a similar approach can be used with Silverlight).&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;We use the object element to link to a .swf version of our audio file, which Flash can play&lt;/li&gt;
&lt;li&gt;We use object to embed a Flash audio player which can play mp3 files&lt;/li&gt;
&lt;/ol&gt;
The
 first approach is simplest, but Flash won’t display controls for the 
sound file — the user will have to context menu click to play, rewind, 
etc.&lt;br /&gt;
The second approach potentially involves hosting an audio 
player at your site, or using a free hosted player such as the Google 
Reader Audio Player, but has the advantage of reducing the number of 
audio files we need to encode, and of providing a better user 
experience.&lt;br /&gt;
In both cases, we use the &lt;code&gt;object&lt;/code&gt; element, as the only browser we really need to worry about is Internet Explorer versions 8 and older, which support &lt;code&gt;object&lt;/code&gt;.
 Unless you’re looking to also cover an old version of a browser that 
doesn’t support object (which to be honest is unlikely), there’s no need
 to also include a nested &lt;code&gt;embed&lt;/code&gt; element inside the &lt;code&gt;object&lt;/code&gt;.&lt;br /&gt;
Here’s how we go about using the &lt;code&gt;object&lt;/code&gt; element to add the Google Reader player, and our sound file.&lt;br /&gt;
&lt;pre&gt;&amp;lt;object type=&quot;application/x-shockwave-flash&quot; data=&quot;http://www.google.com/reader/ui/3523697345-audio-player.swf&quot; width=&quot;400&quot; height=&quot;27&quot; &amp;gt;
        &amp;lt;param name=&quot;flashvars&quot; value=&quot;audioUrl=http://westciv.com/podcasts/youmayknowmypoetry.mp3&quot;&amp;gt;
        &amp;lt;param name=&quot;src&quot; value=&quot;http://www.google.com/reader/ui/3523697345-audio-player.swf&quot;/&amp;gt;
        &amp;lt;param name=&quot;quality&quot; value=&quot;best&quot;/&amp;gt;
&amp;lt;/object&amp;gt;&lt;/pre&gt;
There’s no great need to go into detail here, because all you really need to know is the value of the &lt;code&gt;flashvars&lt;/code&gt; parameter includes the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; of the sound file. Simply replace the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; there, leaving the &lt;code&gt;audioURL=&lt;/code&gt; part as is, and you’ll be fine.&lt;br /&gt;
Note that this fallback &lt;strong&gt;won’t&lt;/strong&gt; work if the browser supports &lt;code&gt;audio&lt;/code&gt;,
 but none of the audio formats you’ve linked to, or if the files go 
missing. The browser in these instances will show the native audio 
player controls (if you’ve used the &lt;code&gt;controls&lt;/code&gt; attribute), but no sound will be played.&lt;br /&gt;
Lastly, what if we have a browser that supports neither &lt;code&gt;audio&lt;/code&gt;, nor the &lt;code&gt;object&lt;/code&gt; element? We can include fallback text (and &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;) within the &lt;code&gt;object&lt;/code&gt; element (or if we choose not to include a flash based fallback, inside the &lt;code&gt;audio&lt;/code&gt; element, after any &lt;code&gt;source&lt;/code&gt;
 elements). We could for example link to a downloadable version of the 
file. Here’s what this would look like if we haven’t included a Flash 
based fallback&lt;br /&gt;
&lt;pre&gt;&amp;lt;audio controls=&quot;controls&quot; loop=&quot;loop&quot;&amp;gt;
 &amp;lt;source src=&quot;http://westciv.com/podcasts/youmayknowmypoetry.mp3&quot;&amp;gt;
 &amp;lt;source src=&quot;http://westciv.com/podcasts/youmayknowmypoetry.ogg&quot;&amp;gt;

 &amp;lt;p&amp;gt;Sadly your browser can&#39;t play this audio file&amp;lt;/p&amp;gt;
 &amp;lt;p&amp;gt;The good news is you can still &amp;lt;a href=&quot;http://westciv.com/podcasts/youmayknowmypoetry.mp&quot;&amp;gt;download an MP3 version&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;/audio&amp;gt;&lt;/pre&gt;
&lt;h4&gt;
Gotchas&lt;/h4&gt;
We’ve covered most of the things 
that can trip you up with audio (with the exception of the whole issue 
of formats and codecs which we’ll cover shortly) but keep in mind these 
as well:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;fallbacks only come into play if the audio element is not supported, not if the file formats aren’t or if the files are missing.&lt;/li&gt;
&lt;li&gt;ogg files must be served as audio/​ogg or application/​ogg. If the server is set up to serve these as another &lt;span class=&quot;caps&quot;&gt;MIME&lt;/span&gt; type, Firefox will ignore them.&lt;/li&gt;
&lt;li&gt;Fallback text is not for the purposes of accessibility, but as a last resort when audio is not supported (we’ll &lt;a href=&quot;http://www.webdirections.org/blog/getting-sourcey-native-html5-audio-and-video/#access&quot;&gt;look at accessibility&lt;/a&gt; in a moment).&lt;/li&gt;
&lt;/ul&gt;
But, on the whole, &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; audio is not particularly complicated, and in my opinion far less of a headache than using plugin based audio with the &lt;code&gt;object&lt;/code&gt; and &lt;code&gt;embed&lt;/code&gt; elements. As I mentioned earlier, I’ve built a &lt;a href=&quot;http://westciv.com/tools/audio/&quot;&gt;web based tool&lt;/a&gt; that helps you create &lt;code&gt;audio&lt;/code&gt; elements, including fallbacks, and hopefully helps you understand exactly what’s going on. &lt;a href=&quot;http://twitter.com/johnallsopp&quot;&gt;Let me know what you think&lt;/a&gt;&lt;br /&gt;
&lt;h3&gt;
&lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Video&lt;/h3&gt;
Let’s now turn to incorporating video in &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;
 documents, and the good news is, it’s more or less identical to audio. 
Where audio and video are the same, we won’t repeat what we’ve covered 
earlier.&lt;br /&gt;
&lt;h4&gt;
Adding the element&lt;/h4&gt;
In place of the audio element, for video we have, not surprisingly, the &lt;code&gt;video&lt;/code&gt; element. As with audio, we recommend you don’t use the &lt;code&gt;src&lt;/code&gt; attribute to link to the video file, but again the &lt;code&gt;source&lt;/code&gt;
 element, so we can link to different formats (as with audio, different 
browsers support different formats, so to cover all modern browsers we 
need at least two different video files).&lt;br /&gt;
&lt;code&gt;video&lt;/code&gt; elements can take all the attributes of the audio element — &lt;code&gt;controls&lt;/code&gt;, &lt;code&gt;loop&lt;/code&gt;, &lt;code&gt;autoplay&lt;/code&gt; and &lt;code&gt;preload&lt;/code&gt;. But in addition, it can also take the &lt;code&gt;poster&lt;/code&gt; attribute. The value of the &lt;code&gt;poster&lt;/code&gt;
 is a url that specifies a file to be used as a placeholder image when 
video is not playing. Here’s a video element, with controls, and a 
poster&lt;br /&gt;
&lt;pre&gt;&amp;lt;video controls=&quot;controls&quot; poster=&quot;http://westciv.com/podcasts/lesson6.jpg&quot;&amp;gt;
&amp;lt;/video&amp;gt;&lt;/pre&gt;
and while this won’t play any video, it will look impressive, something like this&lt;br /&gt;
&lt;img alt=&quot;video player with poster and controls&quot; src=&quot;http://westciv.com/images/wdblogs/audio/poster.png&quot; style=&quot;float: none;&quot; /&gt;&lt;br /&gt;
&lt;h4&gt;
Adding sources&lt;/h4&gt;
Now we need to specify the video files to be played. As with &lt;code&gt;audio&lt;/code&gt;, we use the &lt;code&gt;source&lt;/code&gt;
 element, with the src attribute pointing to the video file to be 
played. To cover modern browsers, we need at least two formats, to 
simplify considerably, h.264 and either ogg/​theora or webM/​VP8.&lt;br /&gt;
&lt;pre&gt;&amp;lt;video controls=&quot;controls&quot; poster=&quot;http://westciv.com/podcasts/lesson6.jpg&quot;&amp;gt;
 &amp;lt;source src=&quot;http://westciv.com/podcasts/lesson6.mp4&quot;&amp;gt;
 &amp;lt;source src=&quot;http://westciv.com/podcasts/lesson6.ogv&quot;&amp;gt;
&amp;lt;/video&amp;gt;&lt;/pre&gt;
Which now gives us video which will play in almost any modern browser, including &lt;span class=&quot;caps&quot;&gt;IE9&lt;/span&gt;. again, we’re going to add fallbacks much as we did for audio, to round out our coverage.&lt;br /&gt;
&lt;h4&gt;
Providing fallbacks&lt;/h4&gt;
The simplest way to add Flash based fallback video content is to create a .swf version of the file, and then embed this in your &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;
 document using the object element. If Flash is installed this will play
 in the user’s browser, and while no controls will be shown, if you add a
 menu parameter with the value of true, then the user can context menu 
click and play, rewind and otherwise control the video.&lt;br /&gt;
&lt;pre&gt;&amp;lt;object type=&quot;application/x-shockwave-flash&quot; data=&quot;http://westciv.com/podcasts/lesson6.swf&quot; width=&quot;320&quot; height=&quot;400&quot;&amp;gt;
    &amp;lt;param name=&quot;movie&quot; value=&quot;http://westciv.com/podcasts/lesson6.swf&quot;&amp;gt;
    &amp;lt;param name=&quot;menu&quot; value=&quot;true&quot;&amp;gt;
  &amp;lt;/object&amp;gt;&lt;/pre&gt;
All we need to concern ourselves with here is 
that we put the url of our video file as the value of the parameter with
 the name “movie”, as well as the data attribute of the object element.&lt;br /&gt;
There are also various Flash based video players we might include, similarly to the way we included the Google Reader &lt;span class=&quot;caps&quot;&gt;MP3&lt;/span&gt; player. This will likely require serving the Flash application, in addition to the video files.&lt;br /&gt;
Again we’ve used only the &lt;code&gt;object&lt;/code&gt; element, as we’re really only looking to ensure &lt;span class=&quot;caps&quot;&gt;IE&lt;/span&gt; 8 and older is served the video, and as these support object there’s no need to also include the embed element.&lt;br /&gt;
Lastly, as with audio, we can provide fallback text or &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; to display when video is not supported. Here, we’ll provide a download link when neither video nor Flash are supported.&lt;br /&gt;
&lt;pre&gt;&amp;lt;video controls=&quot;controls&quot; poster=&quot;http://westciv.com/podcasts/lesson6.jpg&quot;&amp;gt;
 &amp;lt;source src=&quot;http://westciv.com/podcasts/lesson6.mp4&quot;&amp;gt;
 &amp;lt;source src=&quot;http://westciv.com/podcasts/lesson6.ogv&quot;&amp;gt;

 &amp;lt;object type=&quot;application/x-shockwave-flash&quot; data=&quot;http://westciv.com/podcasts/lesson6.swf&quot; width=&quot;320&quot; height=&quot;400&quot;&amp;gt;
  &amp;lt;param name=&quot;movie&quot; value=&quot;http://westciv.com/podcasts/lesson6.swf&quot;&amp;gt;
  &amp;lt;param name=&quot;menu&quot; value=&quot;true&quot;&amp;gt;

  &amp;lt;p&amp;gt;Sadly your browser can&#39;t play this video file&amp;lt;/p&amp;gt;
  &amp;lt;p&amp;gt;The good news is you can still &amp;lt;a href=&quot;http://westciv.com/podcasts/lesson6.mp4&quot;&amp;gt;download an MP4 version&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;

   &amp;lt;/object&amp;gt;

&amp;lt;/video&amp;gt;&lt;/pre&gt;
&lt;h4 id=&quot;gotchas&quot;&gt;
Gotchas&lt;/h4&gt;
&lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;
 video gotchas are similar to those with audio. Fallbacks are only for 
when video is not supported at all. Ensure video files are served with 
the right &lt;span class=&quot;caps&quot;&gt;MIME&lt;/span&gt; type. But on the whole, both audio and video are quite usable today.&lt;br /&gt;
As
 I’ve mentioned, the single biggest challenge is ensuring we serve the 
right video files, to ensure all browsers can play the video. Which 
means delving a little into the more complex issue of formats and 
encodings.&lt;br /&gt;
&lt;h4&gt;
Video and Audio formats&lt;/h4&gt;
Probably I should skip this part, and just point you in the direction of Mark Pilgrim’s fantastic coverage at &lt;a href=&quot;http://diveintohtml5.org/video.html&quot;&gt;Dive Into &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;&lt;/a&gt;. But, I feel I should at least cover this issue briefly, so here goes.&lt;br /&gt;
When we think of video formats, like h.264, there are in fact 2 and usually 3 separate pieces of technology involved.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;There’s the container file — for example &lt;span class=&quot;caps&quot;&gt;MPEG4&lt;/span&gt;, WebM or Ogg&lt;/li&gt;
&lt;li&gt;There’s the video data, encoded with one of many possible codecs (de&lt;strong&gt;cod&lt;/strong&gt;ing/​&lt;strong&gt;e&lt;/strong&gt;n&lt;strong&gt;c&lt;/strong&gt;oding formats) such as H.264, &lt;span class=&quot;caps&quot;&gt;VP8&lt;/span&gt; or Theora&lt;/li&gt;
&lt;li&gt;There’s audio data encoded with one of many possible audio codecs such as mp3, &lt;span class=&quot;caps&quot;&gt;AAC&lt;/span&gt; or Vorbis&lt;/li&gt;
&lt;/ul&gt;
So,
 when we talk about the video format a browser supports, it’s important 
to understand what this actually means. It means the combination of 
container, video and audio encoding.&lt;br /&gt;
With this in mind, The current state of browser support for audio and video formats is&lt;br /&gt;
&lt;h5&gt;
Video&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Firefox 3.6+, Chrome, Android 2.1+ and Opera support Ogg/​Theora (.ogv).&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;IE9&lt;/span&gt;, Safari 4+, Chrome, Android and iOS support &lt;span class=&quot;caps&quot;&gt;MPEG4&lt;/span&gt;/h.264 (.mp4), although Chrome 14 will &lt;a href=&quot;http://blog.chromium.org/2011/01/html-video-codec-support-in-chrome.html&quot;&gt;&lt;strong&gt;drop support&lt;/strong&gt; for the format&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Firefox 4+, Chrome, Opera, and Android (2.3+) support WebM/​VP8 (.webm), as does &lt;span class=&quot;caps&quot;&gt;IE9&lt;/span&gt; if the required codecs are installed on the system (they can be &lt;a href=&quot;http://tools.google.com/dlpage/webmmf/&quot;&gt;downloaded from here&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
So, to cover all modern browsers, we need at a minimum, &lt;span class=&quot;caps&quot;&gt;MPEG4&lt;/span&gt;/h.264 and either Ogg/​Theora or WebM/​VP8&lt;br /&gt;
&lt;h5&gt;
Audio&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Firefox, Chrome, Android and Opera support Ogg/​Vorbis (.ogg).&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;IE9&lt;/span&gt;, Safari, Chrome, Android and iOS support &lt;span class=&quot;caps&quot;&gt;MP3&lt;/span&gt; (.mp3).&lt;/li&gt;
&lt;li&gt;Safari, Chrome, &lt;span class=&quot;caps&quot;&gt;IE&lt;/span&gt; and iOS support &lt;span class=&quot;caps&quot;&gt;AAC&lt;/span&gt; (.aac).&lt;/li&gt;
&lt;/ul&gt;
To cover all modern browsers, we need Ogg/​Vorbis and either &lt;span class=&quot;caps&quot;&gt;MP3&lt;/span&gt; or &lt;span class=&quot;caps&quot;&gt;AAC&lt;/span&gt;.&lt;br /&gt;
&lt;h4&gt;
The &lt;code&gt;type&lt;/code&gt; attribute&lt;/h4&gt;
We mentioned earlier that the &lt;code&gt;source&lt;/code&gt; element can take a &lt;code&gt;type&lt;/code&gt; attribute in addition to the &lt;code&gt;src&lt;/code&gt;
 attribute. While not required, this can help a browser decide whether 
it can actually play the content located at the end of the &lt;code&gt;src&lt;/code&gt; &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;.
 You might think that the file extension would be enough, but not 
necessarily so. For example, iPhone with iOS 4 supports H.264 video up 
to 720p (the so called H.264 “Main Profile”), so can’t play a 1020p 
H.264 encoded video (that is, a “High Profile” H.264 video). If we 
wanted to provide various H.264 profiles, for various devices, all these
 files will have the extension mp4. But we can provide codec information
 in the type attribute to differentiate between the various versions.&lt;br /&gt;
The type attribute’s value provides two pieces of information, separated by a semicolon. First is the &lt;span class=&quot;caps&quot;&gt;MIME&lt;/span&gt;
 type of the file, then (optionally) the codecs used (separated by a 
comma). So, for example we could provide various H.264 profiles of our 
video like so:&lt;br /&gt;
&lt;pre&gt;&amp;lt;source src=&#39;video.mp4&#39; type=&#39;video/mp4; codecs=&quot;avc1.58A01E, mp4a.40.2&quot;&#39;&amp;gt; &amp;lt;!-baseline profile--&amp;gt;
&amp;lt;source src=&#39;video.mp4&#39; type=&#39;video/mp4; codecs=&quot;avc1.4D401E, mp4a.40.2&quot;&#39;&amp;gt;
&amp;lt;!-main profile--&amp;gt;
&amp;lt;source src=&#39;video.mp4&#39; type=&#39;video/mp4; codecs=&quot;avc1.64001E, mp4a.40.2&quot;&#39;&amp;gt; &amp;lt;!-high profile--&amp;gt;
&lt;/pre&gt;
(Which to tell the truth is taken directly from the &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;
 specification, and is beyond my level of understanding of the ins and 
outs of codecs.), but depending on your circumstances, you may find it 
useful to include &lt;span class=&quot;caps&quot;&gt;MIME&lt;/span&gt; type and codecs 
information using the type attribute. If you do, I’m sure you’ll know 
the codecs information to use, and now where to put it.&lt;br /&gt;
&lt;h3 id=&quot;access&quot;&gt;
Accessibility&lt;/h3&gt;
The
 web is about inclusivity and access to as wide an audience as possible,
 which includes those with hearing and visual disabilities. Creating 
accessible audio and video content is far beyond the scope of this 
article, but I do have some links for &lt;a href=&quot;http://www.webdirections.org/blog/getting-sourcey-native-html5-audio-and-video/#reading&quot;&gt;further reading&lt;/a&gt; below. But, it is important to note that, as spelt out in the &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; specification&lt;br /&gt;
&lt;blockquote&gt;
In
 particular, [fallback] content is not intended to address accessibility
 concerns. To make video content accessible to the blind, deaf, and 
those with other physical or cognitive disabilities, authors are 
expected to provide alternative media streams and/​or to embed 
accessibility aids (such as caption or subtitle tracks, audio 
description tracks, or sign-​​language overlays) into their media 
streams.&lt;/blockquote&gt;
&lt;h3&gt;
The tools&lt;/h3&gt;
I’m not sure whether it’s 
stupidity, or laziness, but many aspects of web development, if I’ve not
 used a particular technology for a while, I quickly find myself 
reaching for a reference. And sadder still, it’s often &lt;a href=&quot;http://www.amazon.com/Developing-Web-Standards-John-Allsopp/dp/0321646924/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1257824843&amp;amp;sr=8-1%22%22&quot;&gt;the book I wrote myself&lt;/a&gt;! But in all seriousness, as aspects of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; (not to mention JavaScript and the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;)
 become increasingly complex, our chances of remembering every aspect of
 our craft, along with the subtleties of browser support, grow ever 
smaller (even Einstein was reputed to have said that he didn’t remember 
the speed of light as he could always look it up). Well, mine certainly 
do. So, I write little &lt;a href=&quot;http://westciv.com/tools/&quot;&gt;web based tools&lt;/a&gt; to replace my dwindling brain cells.&lt;br /&gt;
I’ve
 recently developed two new tools, one each for audio and video, that 
help you easily do pretty much all we’ve covered here — create the 
elements, add controls, a poster, and other attributes, sources, and 
fallback audio, video and &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;. It will even tell you which browsers can play a particular file (well, it will make a guess based on the files’ extensions).&lt;br /&gt;
You can find the &lt;a href=&quot;http://westciv.com/tools/audio/&quot;&gt;audio tool here&lt;/a&gt;, and the &lt;a href=&quot;http://westciv.com/tools/video/&quot;&gt;video tool here&lt;/a&gt;.&lt;br /&gt;
There’s also a similar excellent tool for creating &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; video which I wasn’t aware of when creating mine, the &lt;a href=&quot;http://sandbox.thewikies.com/vfe-generator/&quot;&gt;Video for Everybody Generator&lt;/a&gt;. It’s highly recommended.&lt;br /&gt;
&lt;h3 id=&quot;reading&quot;&gt;
Further reading&lt;/h3&gt;
Here’s a few of the many articles and other resources on &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;
 video and audio I’ve come across in my travels. They cover video and 
audio encoding, accessibility, some Flash players you might consider for
 your fallback content, browser support, and more.&lt;br /&gt;
The very best place to start is the video chapter in Mark Pilgrim’s &lt;a href=&quot;http://diveintohtml5.org/video.html&quot;&gt;Dive into &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt; &lt;a href=&quot;http://camendesign.com/code/video_for_everybody&quot;&gt;Video for Everybody&lt;/a&gt;, the originator of the Flash fallback technique for &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Video&lt;br /&gt;
Opera Developer Connection has a series of articles on &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; media, including an &lt;a href=&quot;http://dev.opera.com/articles/view/introduction-html5-video/&quot;&gt;Introduction to &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Video&lt;/a&gt;, and &lt;a href=&quot;http://dev.opera.com/articles/view/everything-you-need-to-know-about-html5-video-and-audio/&quot;&gt;Everything you need to know about &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; audio and video&lt;/a&gt;.&lt;br /&gt;
The &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Doctor has a &lt;a href=&quot;http://html5doctor.com/native-audio-in-the-browser/&quot;&gt;detailed overview of &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Audio&lt;/a&gt;, and &lt;a href=&quot;http://html5doctor.com/the-video-element/&quot;&gt;video&lt;/a&gt;.&lt;br /&gt;
&lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Rocks has several various articles on &lt;a href=&quot;http://www.html5rocks.com/en/features/multimedia&quot;&gt;native &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; media&lt;/a&gt; including a &lt;a href=&quot;http://www.html5rocks.com/en/tutorials/audio/quick/&quot;&gt;quick guide to audio&lt;/a&gt;, the &lt;a href=&quot;http://www.html5rocks.com/en/tutorials/video/basics/&quot;&gt;basics of &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; video&lt;/a&gt;&lt;br /&gt;
&lt;h4&gt;
Encoding your audio and video&lt;/h4&gt;
Here are some great places to get tips and techniques on encoding video and audio for &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;, and services which you can use to create the right formats of your media files&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.encoding.com/&quot;&gt;Encoding​.com&lt;/a&gt; has free and paid encoding services for many audio and video formats&lt;/li&gt;
&lt;li&gt;Here’s a detailed list of &lt;a href=&quot;http://www.reelseo.com/html5-ogg-h264-encoding-tools/&quot;&gt;various encoding services&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;ZenCoder is another &lt;a href=&quot;http://zencoder.com/&quot;&gt;hosted encoding service&lt;/a&gt;, with free service for testing, and various pricing options&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://m.vid.ly/user/&quot;&gt;Vid​.ly&lt;/a&gt; is a service for encoding and hosting video&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Flash players for video and audio fallback&lt;/h4&gt;
There are some open source Flash video players you can host yourself to play your video files.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://flowplayer.org/&quot;&gt;FlowPlayer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.longtailvideo.com/players/jw-flv-player/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;JW&lt;/span&gt; Player&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://mediaelementjs.com/&quot;&gt;Media.js&lt;/a&gt; supports both audio and video with fallbacks to Flash&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://videojs.com/&quot;&gt;VideoJS&lt;/a&gt; is a highly regarded JavaScript &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; player, with fallback support as well. You can skin it with &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://jplayer.org/&quot;&gt;JPlayer&lt;/a&gt; open source jQuery &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Audio /​ Video Library (as used in Pandora)&lt;/li&gt;
&lt;/ul&gt;
In addition to the commonly used Google Reader Flash &lt;span class=&quot;caps&quot;&gt;MP3&lt;/span&gt; Player, other Flash &lt;span class=&quot;caps&quot;&gt;MP3&lt;/span&gt; players you might consider include&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The innovatively named &lt;a href=&quot;http://flash-mp3-player.net/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;MP3&lt;/span&gt; Player&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;And equally so &lt;a href=&quot;http://www.freeflashmp3player.com/&quot;&gt;Free Flash &lt;span class=&quot;caps&quot;&gt;MP3&lt;/span&gt; Player&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Accessibility&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dev.opera.com/articles/view/accessible-html5-video-with-javascripted-captions/&quot;&gt;Captioning &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Video using JavaScript&lt;/a&gt; from the Opera Developer Center&lt;/li&gt;
&lt;li&gt;Creating &lt;a href=&quot;http://webaxe.blogspot.com/2011/03/accessible-youtube-html5-video.html&quot;&gt;Accessible &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; YouTube Video&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Browser support&lt;/h4&gt;
As always &lt;a href=&quot;http://caniuse.com/#search=video&quot;&gt;When Can I Use?&lt;/a&gt; is &lt;strong&gt;the&lt;/strong&gt; place to keep up to date with browser support.&lt;br /&gt;
Addressing challenges playing audio and video in the &lt;a href=&quot;http://www.broken-links.com/2010/07/08/making-html5-video-work-on-android-phones&quot;&gt;Android browser&lt;/a&gt;.&lt;br /&gt;
A look at the &lt;a href=&quot;http://blog.millermedeiros.com/2011/03/html5-video-issues-on-the-ipad-and-how-to-solve-them/&quot;&gt;challenges associated with video on the iPad&lt;/a&gt;.&lt;br /&gt;
A further look at &lt;a href=&quot;http://blog.millermedeiros.com/2011/04/unsolved-html5-video-issues-on-ios/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; media challenges in iOS&lt;/a&gt;.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/7428272264029432707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/7428272264029432707' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7428272264029432707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7428272264029432707'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/getting-sourcey-native-html5-audio-and.html' title='Getting Sourcey — native HTML5 Audio and video'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-7582471445418598429</id><published>2012-01-02T00:18:00.001-08:00</published><updated>2012-01-02T00:18:52.814-08:00</updated><title type='text'>Taking your web sites and apps offline with the HTML5 appcache</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
There’s a general (and understandable) belief by even many developers
 that web sites and web applications can only be used when the browser 
has a web connection. Indeed, this is routinely cited as one of the real
 advantages of “native” apps over web apps. But as unintuitive as it 
sounds, in almost every modern browser and device (except even for now &lt;span class=&quot;caps&quot;&gt;IE10&lt;/span&gt;
 developer previews, but here’s hoping that changes), that’s not the 
case, provided the developer does a little extra work to make their app 
or site persist when a browser is offline. (Of course the user must have
 visited your site while their browser did have a connection)&lt;br /&gt;
In 
this article, I hope to clear this whole areas up once and for all, show
 you how to do it, and point to some great resources out there for 
learning more about creating offline versions of your web sites and 
apps. Perhaps most importantly, introduce a simple new tool I’ve built 
to do the heavy lifting for you, &lt;a href=&quot;http://westciv.com/tools/manifestR/&quot;&gt;ManifestR&lt;/a&gt;.&lt;br /&gt;
Even
 if you develop web sites, rather than applications, you can benefit 
from the techniques outlined here, because caching resources can 
seriously decrease the load time for your site, particularly on a 
visitors subsequent site visits.&lt;br /&gt;
&lt;h4&gt;
Making a cache&lt;/h4&gt;
As I’m sure you know, browsers cache &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;, &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;,
 JavaScript files, images and other resources of the sites you visit, to
 speed up the subsequent loading of pages. However, you never know when 
the browser might discard cached files, and so this is not a reliable 
way for sites to work offline. But what if we &lt;em&gt;could&lt;/em&gt; tell the browser what to cache? Well, with &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; application caches (also known as applications caches or “appcaches”) we can do just that. Let’s look at how.&lt;br /&gt;
&lt;h4&gt;
Making it manifest&lt;/h4&gt;
The
 heart of the technique is to create an appcache manifest, a simple text
 file, which tells the browser what to cache (and also &lt;strong&gt;what not to&lt;/strong&gt;).
 The resources are then cached in an “application cache”, or “appcache”,
 which is distinct from the cache a browser uses for its own purposes. 
The anatomy of an appcache manifest is straightforward, but there are a 
few subtleties.&lt;br /&gt;
An appcache manifest&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;begins with the string “&lt;span class=&quot;caps&quot;&gt;CACHE&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;MANIFEST&lt;/span&gt;” (this is &lt;strong&gt;required&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;has a section, introduced by the string “&lt;span class=&quot;caps&quot;&gt;CACHE&lt;/span&gt;:”
 which specifies the URLs of resources (either absolute, or relative to 
the location where the manifest file will be located on the server) to 
be cached.&lt;/li&gt;
&lt;li&gt;We can also optionally specify which resources should &lt;strong&gt;not&lt;/strong&gt; be cached, in a section of the manifest file introduced by the string “&lt;span class=&quot;caps&quot;&gt;NETWORK&lt;/span&gt;:”.
 These resources aren’t just not cached, but further, won’t be used when
 the user is offline, even if the browser has cached them in its own 
caches.&lt;/li&gt;
&lt;li&gt;We can also optionally specify fallback resources to be used when the user is not connected, in a section of the file called “&lt;span class=&quot;caps&quot;&gt;FALLBACK&lt;/span&gt;:”&lt;/li&gt;
&lt;li&gt;You can add comments to the file with, simply by beginning a line with “#”&lt;/li&gt;
&lt;/ul&gt;
It’s recommended that the extension for a manifest file is &lt;code&gt;.appcache&lt;/code&gt; (previously, &lt;code&gt;.manifest&lt;/code&gt; was the recommended extension).&lt;br /&gt;
Here is a very straightforward example&lt;br /&gt;
&lt;pre&gt;CACHE MANIFEST

CACHE:

#images
/images/image1.png
/images/image2.png

#pages
/pages/page1.html
/pages/page2.html

#CSS
/style/style.css

#scripts
/js/script.js

FALLBACK:
/ /offline.html

NETWORK:
signup.html
&lt;/pre&gt;
&lt;h5&gt;
The &lt;span class=&quot;caps&quot;&gt;CACHE&lt;/span&gt; section&lt;/h5&gt;
In the &lt;span class=&quot;caps&quot;&gt;CACHE&lt;/span&gt; section we list the resources we want cached. We can use either a &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; relative to the .appcache file, or an absolute &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;.
 We can cache resources both in the same domain as the cache, as well as
 (in most cases) other domains (we’ll cover this in more &lt;a href=&quot;http://www.webdirections.org/blog/get-offline/#single-origin&quot;&gt;detail in a moment&lt;/a&gt;)&lt;br /&gt;
Often, the only section of an appcache manifest is this section, in which case, the &lt;span class=&quot;caps&quot;&gt;CACHE&lt;/span&gt;: header may be omitted.&lt;br /&gt;
Be careful with what you cache. Once a resource, for example an &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;
 document is cached, the browser will continue to use this cached 
version, effectively forever, even if you change the file on the server.
 To ensure the browser updates the cache, you need to change the 
.appcache file. This can play havoc while you are developing a site, and
 we’ll cover some &lt;a href=&quot;http://www.webdirections.org/blog/get-offline/#updating&quot;&gt;techniques for managing this&lt;/a&gt; in a moment.&lt;br /&gt;
One
 suggestion is to add a version, and or a date stamp to the manifest as a
 comment. This way, you can quickly change the date or version number, 
and then browsers will refresh the appcache. Browsers do this 
intelligently, checking to see which resources might have changed since 
they were last cached, and only re-​​caching those which have.&lt;br /&gt;
&lt;h5&gt;
The Network Section&lt;/h5&gt;
Probably the most subtle aspect of app caching is the &lt;span class=&quot;caps&quot;&gt;NETWORK&lt;/span&gt;
 section. Because a great many web sites, and particularly applications,
 have dynamically generated content, pulled in from APIs, CGIs and so 
on, we may want to ensure certain resources &lt;strong&gt;aren’t&lt;/strong&gt; cached, and are always directly loaded when the browser is online.&lt;br /&gt;
That’s where the &lt;span class=&quot;caps&quot;&gt;NETWORK&lt;/span&gt; section of the cache comes in. Here, we list the resources we never want to be cached, which is referred to as an “&lt;strong&gt;online whitelist&lt;/strong&gt;”.
 So, in our example above, we are specifying that the page signup.html 
(located at the root of our site — remember the entries in our manifest 
are either absolute or relative URLs) is never cached. When online, any 
request for this page will always cause the page to be loaded from the 
server (even if the browser might have previously cached it itself). 
When the user is offline, any request for this resource resuls in an 
error (again, even if the browser might have cached the resource in its 
own caches).&lt;br /&gt;
We can also specify a group of resources located within a site in the &lt;span class=&quot;caps&quot;&gt;NETWORK&lt;/span&gt; section using a partial &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; (technically a “prefix match pattern”) (note that we can’t use this technique in the &lt;span class=&quot;caps&quot;&gt;CACHE&lt;/span&gt; section, where all resources &lt;strong&gt;must be explicitly listed to be cached in the appcache&lt;/strong&gt;,
 with one exception we’ll get to shortly). Any resources which have URLs
 beginning with this pattern are included in the online whitelist, and 
never cached. As developers we then need to handle the cases where these
 resources aren’t available because the user is offline.&lt;br /&gt;
There’s also a special wildcard, &lt;strong&gt;*&lt;/strong&gt;. The asterisk specifies that any resources that aren’t explicitly cached in the appcache manifest should not be cached.&lt;br /&gt;
&lt;h5&gt;
Fallbacks&lt;/h5&gt;
App caching also allow us to specify fallback resources. The form of an entry in the &lt;span class=&quot;caps&quot;&gt;FALLBACK&lt;/span&gt; section is two resource identification patterns. The first (in the case above simply “/​”, which matches &lt;strong&gt;any resource&lt;/strong&gt;
 in the site), specifies resources to be replaced with a fallback when 
the user is offline. The second specifies the resource to replace any 
resources matching the patter. So, in this case, when any resource in 
the site has not been cached, and the user is offline, the page 
offline.html will be used instead. We can also specify resources to be 
replaced more specifically. For example, we could specify an offline 
image for any images that haven’t been loaded like so&lt;br /&gt;
&lt;pre&gt;/images/ /images/missing.png&lt;/pre&gt;
Here we’re specifying that any resources located in the directory &lt;code&gt;images&lt;/code&gt; at the top level of our site that have not been cached, be replaced with the image called &lt;code&gt;missing.png&lt;/code&gt; found in that same directory, when we are offline.&lt;br /&gt;
&lt;h4&gt;
Using the appcache manifest&lt;/h4&gt;
So now we’ve created our appcache manifest, we need to associate it with our &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; documents. We do this by adding the &lt;code&gt;manifest&lt;/code&gt; attribute to the &lt;code&gt;html&lt;/code&gt; element of a document, where the value of this attribute is the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; of the appcache file.&lt;br /&gt;
The current recommendation is the appcache file have the extension &lt;code&gt;.appcache&lt;/code&gt;. So, if our manifest is located at the root of our site, we’d link to it like so&lt;br /&gt;
&lt;pre&gt;&amp;lt;html manifest=&#39;manifest.appcache&#39;&amp;gt;&lt;/pre&gt;
There are also suggestions that using the &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; doctype may be required for some browsers to use app cache, so, make sure you use the doctype&lt;br /&gt;
&lt;pre&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/pre&gt;
&lt;div id=&quot;mimetype&quot;&gt;
And
 we’re all set. Well, almost. In order for the browser to recognize the 
appcache file, it needs to be served with the mimetype &lt;code&gt;text/cache-manifest&lt;/code&gt;.
 How you set this up depends on your site’s  server. At the time of 
writing, it’s likely that this is a step you’ll need to take, so if 
caching isn’t working, that’s very likely why. One of the most common 
servers is Apache. There are two ways in which you can set up Apache to 
serve .appchace files as type text/​cache-​​manifest. At the root 
directory of your site, add a file with the name &lt;code&gt;.htaccess&lt;/code&gt;, with the entry &lt;code&gt;AddType text/cache-manifest .appcache&lt;/code&gt; (if there’s already a .htaccess file, just add this line to it).&lt;/div&gt;
&lt;h4&gt;
Gotchas&lt;/h4&gt;
App
 caching can be very powerful, allowing apps to work while the user is 
offline, and can increase site performance, but there are some definite 
gotchas it pays to be aware of. Here’s a few well worth knowing about.&lt;br /&gt;
&lt;h5&gt;
Resources in style sheets&lt;/h5&gt;
You’d
 be forgiven for thinking that any images in a style sheet that has been
 cached will be included in the appcache, but that’s not so. Images your
 style sheet refers to must be &lt;strong&gt;explicitly referenced in the &lt;span class=&quot;caps&quot;&gt;CACHE&lt;/span&gt; section of the manifest&lt;/strong&gt; as well.&lt;br /&gt;
Similarly, style sheets that are imported using @import, and resources included via JavaScript must also be explicitly cached.&lt;br /&gt;
To help build an appcache manifest, I’ve developed manifestR, which we’ll &lt;a href=&quot;http://www.webdirections.org/blog/get-offline/#manifestR&quot;&gt;look at in detail in a moment&lt;/a&gt;. It will generate an appcache manifest for you, which includes all the scripts, style sheets, including those &lt;code&gt;@import&lt;/code&gt;ed, images, linked pages at the same site, and any images linked to in stylesheets.&lt;br /&gt;
There’s one exception to the rule that only explicitly listed resources are cached, and it is important to understand. &lt;strong&gt;Any&lt;/strong&gt; &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;
 document that has a manifest attribute will be cached, even if it is 
not listed in the manifest. This can cause all kinds of headaches while 
developing, which we cover shortly.&lt;br /&gt;
&lt;h4 id=&quot;single-origin&quot;&gt;
Caching Cross Domain Resources&lt;/h4&gt;
While there is some confusion on the issue, you &lt;strong&gt;can&lt;/strong&gt;
 in general cache content from across different domains in an app cache.
 In fact, without this ability, the real world value of app caching 
would be limited, as content distributed via a &lt;span class=&quot;caps&quot;&gt;CDN&lt;/span&gt;
 (content distribution networks like Akamai) could not be cached (even 
content served from a differently named server within the same domain 
couldn’t be cached). The exception to this is that when content is 
served over secure http (https), then the specification says all 
resources must come from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Same_origin_policy&quot;&gt;same origin&lt;/a&gt;. In an exception to this exception, Chrome in fact does not adhere to this part of the specification, and it &lt;a href=&quot;http://writing.markchristian.org/whats-wrong-with-appcache&quot;&gt;has been argued&lt;/a&gt; that the single origin policy for https is too restrictive in the real world for app caching to be of genuine value.&lt;br /&gt;
&lt;h4 id=&quot;updating&quot;&gt;
Refreshing the cache&lt;/h4&gt;
In effect, unlike most caching of web resources, appcaches &lt;strong&gt;do not expire&lt;/strong&gt;. So, once the browser has cached a particular resource, it will continue to use that cached version, &lt;strong&gt;even if you change the resource on the server&lt;/strong&gt; (for example by editing the contents of an &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;
 document). The exception to this is when a manifest file is edited. 
When the manifest is changed, the browser will recache all the resources
 listed in the manifest.&lt;br /&gt;
Caching can cause &lt;em&gt;real&lt;/em&gt; headaches
 while developing a site or application, so it is recommended that 
during development, you avoid appcaching. One way of achieving this is 
to serve &lt;code&gt;.appcache&lt;/code&gt; files with the wrong mimetype. This way, you can include the manifest attribute in your &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;
 elements, and serve the appcache file, just as you wold in production, 
but not have the effects of appcaching. Moving from development to 
production is as simple then as &lt;a href=&quot;http://www.webdirections.org/blog/get-offline/#mimetype&quot;&gt;associating .appcache files with the right mimetype&lt;/a&gt;.&lt;br /&gt;
&lt;h5&gt;
Resource hogging and lazy loading&lt;/h5&gt;
To
 improve the performance of a site, you might be tempted to preload the 
entire site, by adding all the pages, images etc in it to the appcache 
manifest. And, in certain circumstances this might be desirable. It will
 however place considerable demands on your server, and use more 
bandwidth, as the first time a person visits your site, they will 
download more resources than they otherwise might have. Luckily, 
appcaches have an additional feature that can help here.&lt;br /&gt;
You might recall earlier that even when an &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;
 document with a link to an appcache manifest isn’t included in the 
manifest file, it will still be cached. The benefit of this is that 
rather than explicitly listing all the pages at your site in a manifest 
for them to be cached, each time someone visits a page that links to a 
manifest, it will &lt;strong&gt;then&lt;/strong&gt; be cached.&lt;br /&gt;
If the primary 
motivation for using an appcache is to ensure your site or more likely 
app works offline, you’ll likely want to explicitly list the pages of 
the site, so that they’ll be available offline even if the user hasn’t 
visited them. If your primary motivation is increased performance, then 
let pages lazily cache when the user visits them, but cache scripts, &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;, and perhaps commonly used images.&lt;br /&gt;
&lt;h5&gt;
Cache failure&lt;/h5&gt;
An important, but subtle gotcha with appcaching is that if &lt;em&gt;even one&lt;/em&gt; of the resources you include in your cache manifest is not available, then &lt;strong&gt;no resources will be cached&lt;/strong&gt;.
 So, it is really important to ensure that any resource listed in your 
appcache manifest is available online. There’s a tool we &lt;a href=&quot;http://www.webdirections.org/blog/get-offline/#tools&quot;&gt;discuss in a moment&lt;/a&gt;, the &lt;a href=&quot;http://manifest-validator.com/&quot;&gt;Cache Manifest Validator&lt;/a&gt;, to help ensure all those resources are online.&lt;br /&gt;
&lt;h5&gt;
Size limits&lt;/h5&gt;
While
 there specification places no limits on the size an appcache can be, 
different browsers, and different devices have different limits. &lt;a href=&quot;http://grinninggecko.com/developing-cross-platform-html5-offline-app-1/&quot;&gt;Grinning Gecko reports&lt;/a&gt; that:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Safari desktop browser (Mac and Windows) have no limit&lt;/li&gt;
&lt;li&gt;Mobile Safari has a &lt;span class=&quot;caps&quot;&gt;10MB&lt;/span&gt; limit&lt;/li&gt;
&lt;li&gt;Chrome has a &lt;span class=&quot;caps&quot;&gt;5MB&lt;/span&gt; limit&lt;/li&gt;
&lt;li&gt;Android browser has no limit to appcache size&lt;/li&gt;
&lt;li&gt;Firefox desktop has unlimited appcache size&lt;/li&gt;
&lt;li&gt;Opera’s appcache limit can be managed by the user, but has a default size of &lt;span class=&quot;caps&quot;&gt;50MB&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
User Permission&lt;/h5&gt;
In
 Firefox, when the user first visits an appcached site, the browser asks
 the user’s permission (as it and other browsers do for location with 
the geo-​​location &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;). However, unlike with geo, other browsers &lt;strong&gt;don’t&lt;/strong&gt;
 ask the user’s permission. Just something to be aware of, as there’ll 
be no guarantee with Firefox that appcaching is being used, even when 
supported.&lt;br /&gt;
&lt;h3 id=&quot;support&quot;&gt;
Flakiness and browser support&lt;/h3&gt;
It 
must also be noted that the general consensus is that appcaching is 
currently far from perfect across all browsers which support it. The 
specification is still in draft, but it should also be noted that most 
browsers have supported at least some appcaching for quite some time.&lt;br /&gt;
According to an amalgam of &lt;a href=&quot;http://caniuse.com/#search=offline&quot;&gt;When can I use&lt;/a&gt;, &lt;a href=&quot;http://diveintohtml5.org/offline.html&quot;&gt;Dive into &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;&lt;/a&gt; and other online resources:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Safari has supported offline web apps since version 4&lt;/li&gt;
&lt;li&gt;Chrome has supported the feature since version 5&lt;/li&gt;
&lt;li&gt;Mobile Safari has supported offline apps since iOS 2.1&lt;/li&gt;
&lt;li&gt;Firefox has supported it since version 3.5&lt;/li&gt;
&lt;li&gt;Opera has supported appcache since version 11&lt;/li&gt;
&lt;li&gt;Internet Explorer as yet does not support offline web apps, including in &lt;span class=&quot;caps&quot;&gt;IE10&lt;/span&gt; developer previews&lt;/li&gt;
&lt;li&gt;Android has support appcache since version 2.1&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;manifestR&quot;&gt;
Introducing ManifestR&lt;/h4&gt;
We’ve
 already mentioned that a particular challenge in creating an appcache 
is identifying all the resources you need to add to the manifest. To 
help you with this, I’ve developed &lt;a href=&quot;http://westciv.com/tools/manifestR/&quot;&gt;ManifestR&lt;/a&gt;,
 an online tool to help you create an appcache manifest for any page. I 
don’t recommend you use it without at least a little additional fine 
tuning, as what it attempts to do is locate any resources referenced 
from a given page. As discussed above, depending on the purpose of your 
appcache, this is likely to be overkill.&lt;br /&gt;
&lt;a href=&quot;&quot;&gt;Drag me to your bookmarks bar.&lt;/a&gt;&lt;br /&gt;
When you use ManifestR on a page, here’s what it looks for&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;images both in the same and other domains referenced in the &lt;code&gt;src&lt;/code&gt; attribute of any &lt;code&gt;img&lt;/code&gt; element in the page.&lt;/li&gt;
&lt;li&gt;links
 to pages in the same domain. This can improve the performance of your 
site for visitors viewing other pages, and is vital if you want the 
entire site/​app to work offline, but means potentially considerable 
additional load on your server the first time someone visits the site. 
Whether you choose to keep this list, or remove some or all of the links
 is an important decision to make.&lt;/li&gt;
&lt;li&gt;style sheets, linked, or included via @import statements, located both in your domain, or other domains&lt;/li&gt;
&lt;li&gt;images linked to in any style sheet, both those in the same domain, or other domains&lt;/li&gt;
&lt;li&gt;JavaScript
 files, both those in the same domain, and served from other domains. 
Here too, you’ll need to consider carefully which to include and which 
you want to add to the online whitelist via the &lt;span class=&quot;caps&quot;&gt;NETWORK&lt;/span&gt; section of the manifest.&lt;/li&gt;
&lt;/ul&gt;
it then puts them all together in a manifest, ready for you to cut and paste, tweak, save and upload.&lt;br /&gt;
I hope you find it useful in building appcache manifests (and make sure you &lt;a href=&quot;http://twitter.com/johnallsopp&quot;&gt;let me know via twitter&lt;/a&gt; what you think, and how we can improve it).&lt;br /&gt;
&lt;h4&gt;
More reading&lt;/h4&gt;
There’s
 quite a bit available online about app caching, though keep in mind the
 specification, and implementations are still somewhat in a state of 
flux. Here’s some articles and other online resources I have found very 
helpful —&lt;br /&gt;
&lt;h5&gt;
Overviews and specifications&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Not the the faint-​​hearted, here’s the latest draft specification on offline browsing, and specifically &lt;a href=&quot;http://www.w3.org/TR/html5/offline.html#appcache&quot;&gt;appcache manifests&lt;/a&gt;. These specifications are written for browser developers, and you should hopefully not need to delve into them.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://appcachefacts.info/&quot;&gt;Apcache facts features facts and details of the workings of the cache, with details on gotchas, and best practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Offline&lt;/strong&gt; section of the fantastic &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Rocks site has &lt;a href=&quot;http://www.html5rocks.com/en/features/offline&quot;&gt;details on appcaching&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Safari, and the webkit browser engine have supported offline appcaching for some time, and &lt;a href=&quot;http://developer.apple.com/library/safari/#documentation/appleapplications/reference/SafariWebContent/Client-SideStorage/Client-SideStorage.html&quot;&gt;Apple has details here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The detailed online book on all thing &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;, Dive into &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;, has an indepth chapter on &lt;a href=&quot;http://diveintohtml5.org/offline.html&quot;&gt;offline apps, and appcaching&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Mozilla has supported offline apps since version 3 of Firefox, with fuller support since 3.5. &lt;a href=&quot;https://developer.mozilla.org/en/offline_resources_in_firefox&quot;&gt;The Mozilla Developer Network has details here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A detailed look at caching, including appcaching &lt;a href=&quot;http://blog.caplin.com/2011/02/14/taming-the-app-cache/&quot;&gt;from Platformability&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
Tutorials and how-​​tos&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;The ever excellent &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Doctors’ &lt;a href=&quot;http://html5doctor.com/go-offline-with-application-cache/&quot;&gt;tutorial&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;A from the basics tutorial on appcache from &lt;a href=&quot;http://www.html5rocks.com/en/tutorials/appcache/beginner/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; Rocks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Another excellent introductory tutorial from &lt;a href=&quot;http://www.sitepoint.com/offline-web-application-tutorial/&quot;&gt;SitePoint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Standardists Estelle Weyl’s take on &lt;a href=&quot;http://www.standardista.com/html5/offline-applications-application-cache-manifest-files&quot;&gt;offline web apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;More fromthe folks at Mozilla on &lt;a href=&quot;http://hacks.mozilla.org/2010/01/offline-web-applications/&quot;&gt;building offline web apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Opera Developers Network on &lt;a href=&quot;http://dev.opera.com/articles/view/offline-applications-html5-appcache/&quot;&gt;building offline web apps&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
Critiques and gotchas&lt;/h5&gt;
as
 we know, all is not yet perfect in the world of the offline web just 
yet. Here are a couple of critiques of the current, and collections of 
gotchas discovered by offline pioneers.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;http guru Mark Nottingham on what’s right, and wrong with &lt;a href=&quot;http://www.mnot.net/blog/2011/06/19/offline_web&quot;&gt;“one confused puppy&lt;/a&gt;”&lt;/li&gt;
&lt;li&gt;Tips and gotchas from app developer &lt;a href=&quot;http://www.bunnyhero.org/category/html5/&quot;&gt;Bunny Hero&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;A few things to know, love and hate &lt;a href=&quot;https://www.touchnoc.com/node/126&quot;&gt;about applicationCache&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.stateless.co/post/6246070973/how-offline-web-apps-should-work&quot;&gt;How offline web apps should work&lt;/a&gt; from Mike Kelly&lt;/li&gt;
&lt;li&gt;Mark Christian, one of the authors of AppCache Facts outlines some things he sees could be improved with &lt;a href=&quot;http://writing.markchristian.org/whats-wrong-with-appcache&quot;&gt;&lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; AppCaching&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The limits do various browsers and devices have on appcache size, from &lt;a href=&quot;http://grinninggecko.com/developing-cross-platform-html5-offline-app-1/&quot;&gt;grinning gecko&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;tools&quot;&gt;
Tools&lt;/h4&gt;
We’ve already mentioned &lt;a href=&quot;http://westciv.com/tools/manifestR/&quot;&gt;ManifestR&lt;/a&gt;, but you should find the &lt;a href=&quot;http://manifest-validator.com/&quot;&gt;The Cache Manifest Validator&lt;/a&gt;
 another really useful tool. Remember, for appcaching to work, every 
resource you list in your manifest must be available, or nothing will be
 cached. The Cache Manifest Validator can make sure all your resources 
are available.&lt;br /&gt;
&lt;h5&gt;
Compatibility&lt;/h5&gt;
Probably the best place to keep up to date with the ever changing field of &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;, &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; and other new web technology support in all modern browsers is &lt;a href=&quot;http://caniuse.com/#search=offline&quot;&gt;When Can I Use?&lt;/a&gt;. You can find a snapshot of &lt;a href=&quot;http://www.webdirections.org/blog/get-offline/#support&quot;&gt;current browser support above&lt;/a&gt;.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/7582471445418598429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/7582471445418598429' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7582471445418598429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7582471445418598429'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/taking-your-web-sites-and-apps-offline.html' title='Taking your web sites and apps offline with the HTML5 appcache'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-4426557076349655210</id><published>2012-01-02T00:17:00.002-08:00</published><updated>2012-01-02T00:17:53.933-08:00</updated><title type='text'>HTML5 selectors API — It’s like a Swiss Army Knife for the DOM</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In the infancy of JavaScript, there was little if any concept of an &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; document object model (&lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;).
 Even though JavaScript was invented to enable web developers to 
manipulate parts of a web page, and in the original implementation, in 
Netscape 2.0, developers could only access the form elements, links, and
 images in a page. Useful for form validation, and first widely used for
 image rollover techniques (think :hover, before &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;), but far from the general purpose tool to create modern web applications we now know (and love/​hate).&lt;br /&gt;
Newer iterations of the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;
 provided developers with access to far more than just that original 
limited range of elements, as well as the ability to insert, modify and 
delete elements in an &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; document. But, cross-​​browser implementations very often differed, and full support for the &lt;span class=&quot;caps&quot;&gt;W3C&lt;/span&gt;’s &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; standards have arguably been treated as far more optional than &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; or &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; support.&lt;br /&gt;
One
 of the many reasons for the success of JavaScript libraries like jQuery
 and Prototype, on top of their easing the pain of cross-​​browser 
development was how they made working with the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; far less painful than it had previously been, and indeed how it was with the standard &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;. Being able to use arbitrary &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; selector notation to get matching elements from a document made the standard &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; methods seem antiquated, or at the every least, far too much like hard work.&lt;br /&gt;
Luckily, the standards and browser developers took notice. The &lt;span class=&quot;caps&quot;&gt;W3C&lt;/span&gt; developed the Selectors &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;, a way of easily accessing elements in the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; using standard &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; selector concepts, and browser developers have baked these into all modern  browsers, way back to &lt;span class=&quot;caps&quot;&gt;IE8&lt;/span&gt;.&lt;br /&gt;
In this short (by my standards) article, we’ll look at the Selectors &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;,
 how you use it, browser support, and some little things you might like 
to keep in mind while using it. Rest assured, it’s now widely supported,
 so in many cases, you can safely use it, potentially with a fallback 
for older browsers (&lt;span class=&quot;caps&quot;&gt;IE7&lt;/span&gt; and older specifically) via libraries like jQuery (or more lightweight selector engines like &lt;a href=&quot;http://sizzlejs.com/&quot;&gt;Sizzle&lt;/a&gt;, which provides this functionality for jQuery, and other libraries).&lt;br /&gt;
&lt;h3&gt;
The Selectors &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;&lt;/h3&gt;
The Selectors &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;, which many would consider to be part of &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;, is in fact a separate, small specification from the &lt;span class=&quot;caps&quot;&gt;W3C&lt;/span&gt;. It provides only two new methods, &lt;code&gt;querySelector&lt;/code&gt;, and &lt;code&gt;querySelectorAll&lt;/code&gt;, for the &lt;code&gt;Document&lt;/code&gt;, &lt;code&gt;Element&lt;/code&gt;, and &lt;code&gt;DocumentFragment&lt;/code&gt; objects (typically, you’ll use these methods on the &lt;code&gt;document&lt;/code&gt; or &lt;code&gt;element&lt;/code&gt; objects.) But do these methods make life easier for developers?&lt;br /&gt;
Before the Selectors &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;, to access an object in the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; we could use these methods:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;getElementById&lt;/code&gt; (from &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; Level 2 Core) — available for the &lt;code&gt;document&lt;/code&gt; element&lt;/li&gt;
&lt;li&gt;&lt;code&gt;getElementsByClassName&lt;/code&gt;, standardized in &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;, after long non standard browser support, which is supported on &lt;code&gt;document&lt;/code&gt;s and &lt;code&gt;element&lt;/code&gt;s&lt;/li&gt;
&lt;li&gt;&lt;code&gt;getElementsByTagName&lt;/code&gt;, from &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; Level 2 Core, available on the &lt;code&gt;document&lt;/code&gt; and &lt;code&gt;element&lt;/code&gt; objects&lt;/li&gt;
&lt;/ul&gt;
And there are some legacy ways of accessing elements on a page, which date from the earliest days of JavaScript:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;links&lt;/code&gt; is a property of the document object which contains all anchor (&lt;code&gt;a&lt;/code&gt;) and &lt;code&gt;area&lt;/code&gt; elements with an &lt;code&gt;href&lt;/code&gt; attribute&lt;/li&gt;
&lt;li&gt;&lt;code&gt;anchors&lt;/code&gt; is a property of the document object which contains all &lt;code&gt;a&lt;/code&gt; elements&lt;/li&gt;
&lt;li&gt;&lt;code&gt;forms&lt;/code&gt; is a property of the document object which contains all form elements&lt;/li&gt;
&lt;/ul&gt;
We can also “traverse” the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;, using:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;childNodes&lt;/code&gt;, a property of the &lt;code&gt;document&lt;/code&gt; and &lt;code&gt;node&lt;/code&gt; objects&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nextSibling&lt;/code&gt;, a property of a &lt;code&gt;node&lt;/code&gt;, which contains the element directly following  it in the same parent element&lt;/li&gt;
&lt;li&gt;&lt;code&gt;parentElement&lt;/code&gt;, a property of a node, which contains its parent element.&lt;/li&gt;
&lt;/ul&gt;
and related &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; traversal properties and methods.&lt;br /&gt;
But,
 what developers really often want to be able to do (as the success of 
jQuery and other libraries has shown) is simply say “give me all the 
elements which match this selector”, or “give me the first element which
 matches this selector”. And that’s precisely what the simple, powerful 
Selectors &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; does. It doesn’t completely do away with the need for &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; traversal, and legacy methods and properties, but it goes a long, long way.&lt;br /&gt;
&lt;h4&gt;
querySelector&lt;/h4&gt;
&lt;code&gt;querySelector&lt;/code&gt;
 is a method of the document or any element, which returns the first 
descendent element which would be selected by its one argument, a &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; selector string. We can use this in place of the &lt;code&gt;document.getElementById(&#39;content&#39;)&lt;/code&gt; like so: &lt;code&gt;document.querySelector(&#39;#content&#39;)&lt;/code&gt; (like me, you’ll probably find yourself forgetting to add the &lt;code&gt;#&lt;/code&gt; from time to time in &lt;code&gt;querySelector&lt;/code&gt;, something which doesn’t throw an error, so can be frustrating to track down).&lt;br /&gt;
And we can do things like find the first &lt;code&gt;header&lt;/code&gt; element in an &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; document, with &lt;code&gt;querySelector(&#39;header&#39;)&lt;/code&gt;. So far so good. But where &lt;code&gt;querySelector&lt;/code&gt; really shines is we can use &lt;strong&gt;any&lt;/strong&gt; selector (attribute, structural, dynamic, &lt;span class=&quot;caps&quot;&gt;UI&lt;/span&gt;, and even selector groups) with it. In most cases, this makes traversing the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;,
 and locating a specific element far simpler, and most likely far 
quicker, as we won’t be looping in JavaScript and accessing all kinds of
 &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; properties, rather, the query is taking place inside the browser’s far faster native &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; engine.&lt;br /&gt;
&lt;h4&gt;
querySelectorAll&lt;/h4&gt;
Often, when working with the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;,
 we want to manipulate several elements at once, For example, we might 
want to unobtrusively attach an event listener to all the links with a 
given &lt;code&gt;class&lt;/code&gt; value. Here, &lt;code&gt;querySelectorAll&lt;/code&gt; is your friend. Just like &lt;code&gt;querySelector&lt;/code&gt;, it takes a single string as an argument, which is a &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 selector. Instead of returning a single element, it returns a NodeList 
(a kind of JavaScript array) of matching elements. We can then iterate 
through this array, and manipulate these objects.&lt;br /&gt;
For example, we could use it to replace &lt;code&gt;document.links&lt;/code&gt; like so:&lt;br /&gt;
&lt;pre&gt;document.querySelectorAll(&#39;area[href], a[href]&#39;)&lt;/pre&gt;
This finds all &lt;code&gt;area&lt;/code&gt; elements with the &lt;code&gt;href&lt;/code&gt; attribute set, as well as all &lt;code&gt;a&lt;/code&gt; elements with this attribute set as well (notice how we’ve used a selector group, which is quite acceptable with the Selectors &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;).&lt;br /&gt;
Matching elements are returned in the order they appear in the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; parse tree.&lt;br /&gt;
&lt;h4&gt;
Document or Element?&lt;/h4&gt;
I mentioned that both the &lt;code&gt;document&lt;/code&gt;, and &lt;code&gt;element&lt;/code&gt;
 objects implement these two methods — what’s the difference? Well, as 
you might have guessed, these methods find elements that are descendants
 of the object you query on. So, if you use the method on a paragraph 
element, it will only find the descendant elements of that paragraph 
which match the selector. Other elements in the document which might 
match it won’t be returned. But, if you use the methods on the document,
 then any matching element in the document can be found.&lt;br /&gt;
&lt;h3&gt;
Gotchas&lt;/h3&gt;
If you’ve really got your hands dirty with the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;, you’ll know that when &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; methods return a NodeList, it is live—that is, the members of the list change, depending on the state of the document.&lt;br /&gt;
Let’s say we get all the elements with a &lt;code&gt;class&lt;/code&gt; of “nav” using &lt;code&gt;document.getElementsByClassName(&#39;nav&#39;)&lt;/code&gt;, and it returns 5 elements, which we keep in a variable.&lt;br /&gt;
Now, if we add a new element with &lt;code&gt;class&lt;/code&gt; nav, or remove one of the existing elements with a &lt;code&gt;class&lt;/code&gt; of nav, the NodeList in our variable will be updated to reflect these changes (that’s why it is called a &lt;strong&gt;live&lt;/strong&gt; NodeList).&lt;br /&gt;
But &lt;code&gt;querySelector&lt;/code&gt; and &lt;code&gt;querySelectorAll&lt;/code&gt; are different. While they return a NodeList, it is &lt;strong&gt;static&lt;/strong&gt;. So, if we similarly get all elements with a &lt;code&gt;class&lt;/code&gt; of nav using &lt;code&gt;document.querySelectorAll(&#39;.nav&#39;)&lt;/code&gt;, then regardless of what we subsequently do to the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;, the length and contents of the NodeList won’t change. Which means, it’s always best to query the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; just before you need the elements, rather than holding on to elements if your &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; is going to change.&lt;br /&gt;
There’s also a performance consideration. Tests of various browsers indicate that &lt;code&gt;querySelectorAll&lt;/code&gt; is slower than &lt;code&gt;getElementByTagName&lt;/code&gt;
 (though not it would appear in Opera). But, it’s also possible that 
once available, manipulating the static NodeList may be higher 
performance than manipulating a dynamic NodeList. And this issue will 
likely only have an impact in extreme cases. I’d certainly not recommend
 prematurely optimising by using &lt;code&gt;getElementsByTagName&lt;/code&gt;, &lt;code&gt;getElementsByClass&lt;/code&gt;, &lt;code&gt;getElementById&lt;/code&gt; and so on in place of &lt;code&gt;querySelectorAll&lt;/code&gt;, but it is worth noting you might be able to squeeze a little more performance out by doing so if you really need to.&lt;br /&gt;
And it is worth noting too that &lt;code&gt;querySelector&lt;/code&gt; and &lt;code&gt;querySelectorAll&lt;/code&gt; don’t work with every kind of selector. While pseudo-​​class selectors (like &lt;code&gt;:visited&lt;/code&gt;) work with these methods, pseudo-​​element selectors, like &lt;code&gt;:first-letter&lt;/code&gt;, &lt;code&gt;:first-line&lt;/code&gt;, &lt;code&gt;:before&lt;/code&gt; and &lt;code&gt;:after&lt;/code&gt; although permissible as arguments, will return &lt;code&gt;null&lt;/code&gt; in the case of &lt;code&gt;querySelector&lt;/code&gt;, and an array of length zero for &lt;code&gt;querySelectorAll&lt;/code&gt;.&lt;br /&gt;
A little gotcha this aging developer has found I’m so used to &lt;code&gt;getElementById&lt;/code&gt; and &lt;code&gt;getElementsByClassName&lt;/code&gt; that I find myself forgetting the &lt;code&gt;#&lt;/code&gt; or &lt;code&gt;.&lt;/code&gt; required in the selector string in &lt;code&gt;querySeletor&lt;/code&gt; and &lt;code&gt;querySelectorAll&lt;/code&gt;. As I mentioned a moment ago, it can be frustrating, as this won’t throw an error, but simply return null or an empty NodeList.&lt;br /&gt;
&lt;h3&gt;
Support&lt;/h3&gt;
All modern browsers, including &lt;span class=&quot;caps&quot;&gt;IE8&lt;/span&gt; and up support both &lt;code&gt;querySelector&lt;/code&gt; and &lt;code&gt;querySelectorAll&lt;/code&gt;. It is however worth noting that the results returned are dependent on what selectors the browser supports. &lt;span class=&quot;caps&quot;&gt;IE8&lt;/span&gt; supports &lt;span class=&quot;caps&quot;&gt;CSS2&lt;/span&gt;.1 selectors, though not &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; selectors. &lt;span class=&quot;caps&quot;&gt;IE9&lt;/span&gt; supports many &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; selectors, but not a number of the &lt;span class=&quot;caps&quot;&gt;UI&lt;/span&gt; related pseudo-​​classes, such as &lt;code&gt;:required&lt;/code&gt; and &lt;code&gt;:invalid&lt;/code&gt;. &lt;span class=&quot;caps&quot;&gt;IE&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; support for versions 5 through 9 is &lt;a href=&quot;http://www.webdirections.org/blog/html5-selectors-api-its-like-a-swiss-army-knife-for-the-dom/%3Ca%20href=%22http://msdn.microsoft.com/en-us/library/cc351024%28v=vs.85%29.aspx#selectors%22%3E&quot;&gt;extensively covered here by Microsoft&lt;/a&gt;.&lt;br /&gt;
So, keep in mind, even where these methods are supported, what they return is only as good as the &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; selector support in that browser.&lt;br /&gt;
&lt;h3&gt;
The Wrap-​​up&lt;/h3&gt;
If you’re more of a web designer who’s always been a little intimidated by the thought of wading through the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; in search of elements (trust me, even seasoned developers often wince at the thought), then &lt;code&gt;querySelector&lt;/code&gt; and &lt;code&gt;querySelectorAll&lt;/code&gt; are a boon for you. Or, if you’re a developer who finds yourself going straight for jQuery or another library as soon as the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; is involved, the Selectors &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; might just save you a few KBs, additional files and fussing around. And, if you’re one of those seasoned &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;
 experts, I’m sure there’s plenty of times you’ll breathe a sigh of 
relief that rather than wading through an entire document with &lt;code&gt;childNodes&lt;/code&gt;, &lt;code&gt;nextElementSibling&lt;/code&gt; and the like, a single call to &lt;code&gt;querySelectorAll&lt;/code&gt; will return all the elements you want. I reckon these two are my favourite, and now most used &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; methods, and I’m only surprised they aren’t more widely covered, as they really are like a Swiss Army Knife for the &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt;. Perhaps we need a “top 2 Selectors &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; methods” article. Then again…&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/4426557076349655210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/4426557076349655210' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/4426557076349655210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/4426557076349655210'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/html5-selectors-api-its-like-swiss-army.html' title='HTML5 selectors API — It’s like a Swiss Army Knife for the DOM'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-7211511696680841435</id><published>2012-01-02T00:17:00.000-08:00</published><updated>2012-01-02T00:17:12.720-08:00</updated><title type='text'>Let the Web move you — CSS3 Animations and Transitions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h3&gt;
A brief history on Animation of the Web&lt;/h3&gt;
If you’ve been developing for, or even just &lt;em&gt;using&lt;/em&gt;
 the web for more than about 15&amp;nbsp;years, you’ll likely remember a time 
when animated effects were the bomb. Animated GIFs adorned just about 
every page, spinning globes, little men with jack hammers, 
self-​​folding winged envelopes. And if you’re very unlucky, you’ll 
remember the explosion of blinking content on the web around 1995, as 
the &lt;code&gt;blink&lt;/code&gt; element in the then dominant Netscape browser 
took hold of the imagination of designers everywhere (for killing off 
the non-​​standard &lt;code&gt;blink&lt;/code&gt; element alone, the web standards 
movement deserves at the very least a Noble Peace Prize). And perhaps 
the single widest JavaScript use in its earliest days was for creating 
image rollovers, until &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; got into the act with the hover state. In short, animation has had a long, if checkered career on the web.&lt;br /&gt;
Then,
 for years, animation fell out of favour, but with the rise of 
JavaScript libraries, we’ve seen the re-​​emergence of animated 
interfaces.&lt;br /&gt;
&lt;h3&gt;
&lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; animation&lt;/h3&gt;
In the last 2 or 3&amp;nbsp;years, &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt;
 has got into the act, providing a reasonably straightforward 
declarative way of creating even quite sophisticated animations, where 
complex JavaScript had previously been required.&lt;br /&gt;
In this article we’ll take a look at two related ways &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; provides for creating animations and animated effects, &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Transitions and &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Animations. We’ll look at how to create them, browser support, some interesting gotchas, and yet again, I’ll introduce a tool, &lt;a href=&quot;http://westciv.com/tools/animations/&quot;&gt;AnimatR&lt;/a&gt;, I’ve created to help you more easily, and quickly, create cross-​​browser &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 animations. But please use animations wisely, tastefully and sparingly —
 we’ve take nearly 15&amp;nbsp;years to recover from the “blink tag”. Let’s not 
wait until 2026 for our next opportunity to get animations on the web 
right.&lt;br /&gt;
&lt;h4&gt;
The JavaScript controversy&lt;/h4&gt;
First up, let’s address a now fading controversy. When &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; animations were first proposed and &lt;a href=&quot;http://www.webkit.org/blog/138/css-animation/&quot;&gt;experimentally introduced in Webkit&lt;/a&gt;,
 (coming up on 4&amp;nbsp;years ago now), many prominent, thoughtful developers 
felt strongly that animations were rightfully the domain of JavaScript, 
not &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;. Among the strongest, and most articulate, of those critics was &lt;a href=&quot;http://snook.ca/archives/javascript/css_animations_in_safari/&quot;&gt;Jonathan Snook&lt;/a&gt;, who subsequently &lt;a href=&quot;http://snook.ca/archives/html_and_css/shifting-opinion-css-animations&quot;&gt;revisited his concerns&lt;/a&gt;,
 and changed his position. In short, the concern is that animation is a 
kind of behavior, considered the domain of JavaScript, not presentation,
 the domain of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;. But the simplest way of 
understanding an animation is that it is the change of presentational 
aspects of an element (height, width, color, etc.) over time. In short, 
animations are presentation, even if prior to &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; Transitions and Animations, they could only be achieved via JavaScript.&lt;br /&gt;
We also increasingly have the benefit that &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 based animation is being hardware accelerated in browsers, making for 
smoother animations and transitions even on relatively low powered 
mobile devices.&lt;br /&gt;
Let’s begin with the simpler &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Transitions, then continue with &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 Animations. Animations reuse many of the concepts, and even syntax of 
transitions, so what we learn about transitions we can apply with 
animations as well.&lt;br /&gt;
&lt;h3&gt;
Transitions&lt;/h3&gt;
In &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt;,
 there are two kinds of animated effects — transitions and animations, 
which work in very similar ways. You might even think of transitions as 
simple kinds of animations. &lt;strong&gt;Transitions&lt;/strong&gt; are the animation from one set of an element’s &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; property values of to another set. At their simplest, that might be a smooth animation from a &lt;code&gt;background-color&lt;/code&gt; of red to a &lt;code&gt;background-color&lt;/code&gt; of green.&lt;br /&gt;
&lt;strong&gt;Animations&lt;/strong&gt; enable multiple changes to the presentational properties of an element over time — for example a 2&amp;nbsp;second animation from &lt;code&gt;background-color&lt;/code&gt;
 of red to green, then a 1&amp;nbsp;second transition back to red again, repeated
 indefinitely (we’ll see less boring, and more useful animation examples
 shortly).&lt;br /&gt;
First introduced in Webkit and now supported across all modern browsers, including &lt;span class=&quot;caps&quot;&gt;IE10&lt;/span&gt; developer previews, transitions allow us to animate the change in presentation between two states, that is two sets of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 properties. At its simplest, a transition might be just a smooth change
 from one value of a property to another value, over a specified period 
of time — for example, the smooth change of height  over 2&amp;nbsp;seconds. To 
create simple transitions, we use the &lt;code&gt;transition-property&lt;/code&gt; property, with a space separated list of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; properties to be animated, and the &lt;code&gt;transition-duration&lt;/code&gt; property, to specify how long the animation should take.&lt;br /&gt;
Here’s a really simple example: let’s cross fade a background-​​color from red to blue in 2&amp;nbsp;seconds.&lt;br /&gt;
&lt;pre&gt;p {
 transition-property: background-color;
 transition-duration: 2s;
 background-color: red;
}&lt;/pre&gt;
Which leaves one simple question to answer — how do we trigger
 the change, and so the animated transition? Well, here’s the deceptive 
simplicity of transitions — they take place &lt;strong&gt;any time&lt;/strong&gt; the specified property (in this case &lt;code&gt;background-color&lt;/code&gt;) changes. So, if the &lt;code&gt;background-color&lt;/code&gt; changes because we have a different &lt;code&gt;background-color&lt;/code&gt; specified for the hover or other state, or if we use JavaScript to change the &lt;code&gt;background-color&lt;/code&gt;, then those changes in color will be animated! Let’s try it out. If we specify a different &lt;code&gt;background-color&lt;/code&gt; when the paragraph is in a hover state, like so:&lt;br /&gt;
&lt;pre&gt;p:hover {
 background-color: blue;
}
&lt;/pre&gt;
Then any time you hover over a &lt;code&gt;p&lt;/code&gt; element, the color will fade. Let’s see that in action below&lt;br /&gt;
&lt;div style=&quot;-moz-transition-duration: 2s; -moz-transition-property: background-color; background-color: red; color: black;&quot;&gt;
In all modern browsers (except &lt;span class=&quot;caps&quot;&gt;IE9&lt;/span&gt;) this background color should fade from red to blue when you hover over it&lt;/div&gt;
&lt;div class=&quot;protip&quot;&gt;
A little pro tip as we go along — make sure you put the transition properties (&lt;code&gt;transition-property&lt;/code&gt;, &lt;code&gt;transition-delay&lt;/code&gt; etc.) on the element in its normal, not hover state.&lt;/div&gt;
But what’s with the &lt;code&gt;s&lt;/code&gt; unit for the &lt;code&gt;transition-duration&lt;/code&gt; property? &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; has in fact had units of time since &lt;span class=&quot;caps&quot;&gt;CSS2&lt;/span&gt;. Originally part of Aural Style Sheets, we can specify time in either seconds (&lt;code&gt;s&lt;/code&gt;) or milliseconds (&lt;code&gt;ms&lt;/code&gt;) — 1,000&amp;nbsp;milliseconds in a second. &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; Transitions and Animations reuse these units, which are also part of &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; of course.&lt;br /&gt;
So,
 hopefully the basic idea is clear — with transitions we tell a browser 
that when a certain property or set of properties change, the change 
should not be abrupt, but be animated over a certain time period. Now, 
you might have noticed in the transition above the text color changes 
too — but does so without an animation. That’s because we’ve only 
specified that the &lt;code&gt;background-color&lt;/code&gt; have an animated transition, via &lt;code&gt;transition-property&lt;/code&gt;. We can as mentioned specify multiple properties, by listing each in a comma separated list of property names like so:&lt;br /&gt;
&lt;pre&gt;transition-property: background-color, color;&lt;/pre&gt;
If we want all of the transitions to take the same amount of time, we can specify a single &lt;code&gt;transition-duration&lt;/code&gt;
 property value. But, if we want different properties to transition over
 different time periods, we do so by listing the time values in a comma 
separated list — with the time periods and properties in the same 
position in their respective lists. Here for instance, the &lt;code&gt;color&lt;/code&gt; will transition over 1s, while the &lt;code&gt;background-color&lt;/code&gt; will do so over 2s:&lt;br /&gt;
&lt;pre&gt;p {
 transition-property: background-color, color;
 transition-duration: 2s, 1s;
 background-color: red;
}&lt;/pre&gt;
And here this is in action:&lt;br /&gt;
&lt;div style=&quot;-moz-transition-duration: 2s, 1s; -moz-transition-property: background-color, color; background-color: red; color: black;&quot;&gt;
In all modern browsers (except &lt;span class=&quot;caps&quot;&gt;IE9&lt;/span&gt;)
 this background color should fade from red to blue when you hover over 
it, over a 2&amp;nbsp;second period, while the text color changes from black to 
green over 1&amp;nbsp;second.&lt;/div&gt;
If we want to animate the changes for &lt;em&gt;any&lt;/em&gt; properties which change, we can use the keyword &lt;code&gt;all&lt;/code&gt; as the value for &lt;code&gt;transition-property&lt;/code&gt;.
 This will ensure that regardless of which property changes, that change
 will be animated (not all properties can in fact be animated — we’ll 
cover which ones can be &lt;a href=&quot;http://www.webdirections.org/blog/let-the-web-move-you-css3-animations-and-transitions/#supported-properties&quot;&gt;shortly&lt;/a&gt;). Be careful with the &lt;code&gt;all&lt;/code&gt;
 keyword — should future properties support animation, these will be 
animated, and it may not be clear at this stage just what these 
animations will look like.&lt;br /&gt;
There’s also the shorthand &lt;code&gt;transition&lt;/code&gt; property which takes a &lt;strong&gt;space separated&lt;/strong&gt; property name and time values like so:&lt;br /&gt;
&lt;pre&gt;p {
 transition: background-color 2s;
}&lt;/pre&gt;
&lt;div class=&quot;protip&quot;&gt;
Note how there are &lt;strong&gt;no commas&lt;/strong&gt; between the property and time value.&lt;/div&gt;
Or, if we have multiple property and time pairs, we separate each pair with a commas, like so&lt;br /&gt;
&lt;pre&gt;p {
 transition: background-color 2s, color 1s;
}&lt;/pre&gt;
And in a nutshell, that’s the core of &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; transitions. We’ll touch on some &lt;a href=&quot;http://www.webdirections.org/blog/let-the-web-move-you-css3-animations-and-transitions/#supported-properties&quot;&gt;gotchas&lt;/a&gt; (most of which are shared with animations) a little later. And we’ll take a look at &lt;a href=&quot;http://www.webdirections.org/blog/let-the-web-move-you-css3-animations-and-transitions/#transition-browser-support&quot;&gt;browser support in detail&lt;/a&gt;
 in just a moment. But there are some optional features of transitions 
you might find useful, including specifying the nature of the 
transition, and a delay before a transition starts.&lt;br /&gt;
&lt;h4&gt;
Transition Timing Functions&lt;/h4&gt;
When
 a transition occurs, there are various ways the intermediate steps can 
take place. Let’s take the example of an element moving from left to 
right across the screen, over 2&amp;nbsp;seconds:&lt;br /&gt;
&lt;div style=&quot;position: relative;&quot;&gt;
&lt;div style=&quot;-moz-transition-duration: 2s; -ms-transition-duration: 2s; -ms-transition-property: left; -o-transition-duration: 2s; -o-transition-property: left; -webkit-transition-duration: 2s -moz-transition-property: left; -webkit-transition-duration: 2s; -webkit-transition-property: left; -webkit-transition-property: left; left: 0%; position: relative; width: 20%;&quot;&gt;
This element moves from left: 0% to left: 80% in 2s when you &lt;strong&gt;click&lt;/strong&gt; it. It reverses this when you click it again.&lt;/div&gt;
&lt;/div&gt;
Notice
 how it begins quickly, then slows down as the transition draws to an 
end. Now, take a look at the same transition below, with a very slight 
change.&lt;br /&gt;
&lt;div style=&quot;position: relative;&quot;&gt;
&lt;div style=&quot;-moz-transition-duration: 2s; -moz-transition-property: left; -moz-transition-timing-function: linear; -ms-transition-duration: 2s; -ms-transition-property: left; -ms-transition-timing-function: linear; -o-transition-duration: 2s; -o-transition-property: left; -o-transition-timing-function: linear; -webkit-transition-duration: 2s; -webkit-transition-property: left; -webkit-transition-timing-function: linear; left: 0%; position: relative; transition-duration: 2s; transition-property: left; transition-timing-function: linear; width: 20%;&quot;&gt;
This element moves from left: 0% to left: 80% in 2s when you when you &lt;strong&gt;click&lt;/strong&gt; it. It reverses this when you click it again.&lt;/div&gt;
&lt;/div&gt;
The difference between the two is they have different &lt;code&gt;transition-timing-function&lt;/code&gt;
 properties. This property “describes how the intermediate values used 
during a transition will be calculated”. There are 5 timing function 
keywords (as well as some more complicated ways of describing timing 
functions mathematically using Bezier curves which we won’t go into 
here), &lt;code&gt;ease&lt;/code&gt;, &lt;code&gt;linear&lt;/code&gt;, &lt;code&gt;ease-in&lt;/code&gt;, &lt;code&gt;ease-out&lt;/code&gt;, &lt;code&gt;ease-in-out&lt;/code&gt;.&lt;br /&gt;
Each
 of these is defined in mathematical terms in the specification, but it 
makes much more sense to let you see them all in action.&lt;br /&gt;
&lt;div style=&quot;position: relative;&quot;&gt;
&lt;div class=&quot;timingdemo&quot; style=&quot;-moz-transition-duration: 2s; -moz-transition-property: left; -moz-transition-timing-function: ease; -ms-transition-duration: 2s; -ms-transition-property: left; -ms-transition-timing-function: ease; -o-transition-duration: 2s; -o-transition-property: left; -o-transition-timing-function: ease; -webkit-transition-duration: 2s; -webkit-transition-property: left; -webkit-transition-timing-function: ease; left: 0%; position: relative; transition-duration: 2s; transition-property: left; transition-timing-function: ease; width: 20%;&quot;&gt;
This transition has a timing function of &lt;strong&gt;ease&lt;/strong&gt;, the default timing function. Click it to see it in action.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-top: 2em; position: relative;&quot;&gt;
&lt;div class=&quot;timingdemo&quot; style=&quot;-moz-transition-duration: 2s; -moz-transition-property: left; -moz-transition-timing-function: linear; -ms-transition-duration: 2s; -ms-transition-property: left; -ms-transition-timing-function: linear; -o-transition-duration: 2s; -o-transition-property: left; -o-transition-timing-function: linear; -webkit-transition-duration: 2s; -webkit-transition-property: left; -webkit-transition-timing-function: linear; left: 0%; position: relative; transition-duration: 2s; transition-property: left; transition-timing-function: linear; width: 20%;&quot;&gt;
This transition has a timing function of &lt;strong&gt;linear&lt;/strong&gt;. Click it to see it in action.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-top: 2em; position: relative;&quot;&gt;
&lt;div class=&quot;timingdemo&quot; style=&quot;-moz-transition-duration: 2s; -moz-transition-property: left; -moz-transition-timing-function: ease-in; -ms-transition-duration: 2s; -ms-transition-property: left; -ms-transition-timing-function: ease-in; -o-transition-duration: 2s; -o-transition-property: left; -o-transition-timing-function: ease-in; -webkit-transition-duration: 2s; -webkit-transition-property: left; -webkit-transition-timing-function: ease-in; left: 0%; position: relative; transition-duration: 2s; transition-property: left; transition-timing-function: ease-in; width: 20%;&quot;&gt;
This transition has a timing function of &lt;strong&gt;ease-​​in&lt;/strong&gt;. Click it to see it in action.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-top: 2em; position: relative;&quot;&gt;
&lt;div class=&quot;timingdemo&quot; style=&quot;-moz-transition-duration: 2s; -moz-transition-property: left; -moz-transition-timing-function: ease-out; -ms-transition-duration: 2s; -ms-transition-property: left; -ms-transition-timing-function: ease-out; -o-transition-duration: 2s; -o-transition-property: left; -o-transition-timing-function: ease-out; -webkit-transition-duration: 2s; -webkit-transition-property: left; -webkit-transition-timing-function: ease-out; left: 0%; position: relative; transition-duration: 2s; transition-property: left; transition-timing-function: ease-out-out; width: 20%;&quot;&gt;
This transition has a timing function of &lt;strong&gt;ease-​​out&lt;/strong&gt;. Click it to see it in action.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-top: 2em; position: relative;&quot;&gt;
&lt;div class=&quot;timingdemo&quot; style=&quot;-moz-transition-duration: 2s; -moz-transition-property: left; -moz-transition-timing-function: ease-in-out; -ms-transition-duration: 2s; -ms-transition-property: left; -ms-transition-timing-function: ease-in-out; -o-transition-duration: 2s; -o-transition-property: left; -o-transition-timing-function: ease-in-out; -webkit-transition-duration: 2s; -webkit-transition-property: left; -webkit-transition-timing-function: ease-in-out; left: 0%; position: relative; transition-duration: 2s; transition-property: left; transition-timing-function: ease-in-out-in-out; width: 20%;&quot;&gt;
This transition has a timing function of &lt;strong&gt;ease-​​in-​​out&lt;/strong&gt;. Click it to see it in action.&lt;/div&gt;
&lt;/div&gt;
We specify an optional timing function (as noted above, the default is &lt;code&gt;ease&lt;/code&gt;) using the property &lt;code&gt;transition-timing-function&lt;/code&gt;,
 with one of the keywords above as its value. As mentioned, we can 
specify a timing function as a cubic Bezier curve, but if you need to 
get this technical with your transitions, the best place to understand 
the details is the &lt;a href=&quot;http://dev.w3.org/csswg/css3-transitions/#transition-timing-function_tag&quot;&gt;specification&lt;/a&gt;.&lt;br /&gt;
Which timing function you choose is a matter of taste, and for most purposes, the default value of &lt;code&gt;ease&lt;/code&gt; should be fine.&lt;br /&gt;
&lt;h4&gt;
Delay&lt;/h4&gt;
There
 may be occasions on which we want a transition to delay for a certain 
amount of time before commencing, and we can do this quite 
straightforwardly with the &lt;code&gt;transition-delay&lt;/code&gt; property. As with &lt;code&gt;transition-duration&lt;/code&gt; we do this using a time value in seconds or milliseconds.&lt;br /&gt;
&lt;pre&gt;transition-duration: 150ms;&lt;/pre&gt;
We can also specify different delays for different transitions, like this (&lt;strong&gt;click&lt;/strong&gt; the element below to see the effect):&lt;br /&gt;
&lt;div style=&quot;margin-top: 2em; position: relative;&quot;&gt;
&lt;div id=&quot;ufo&quot; style=&quot;-moz-transition-delay: 0s, 1s; -moz-transition-duration: 1s, 3s; -moz-transition-property: top, left; -ms-transition-delay: 0s, 1s; -ms-transition-duration: 1s, 3s; -ms-transition-property: top, left; -o-transition-delay: 0s, 1s; -o-transition-duration: 1s, 3s; -o-transition-property: top, left; -webkit-transition-delay: 0s, 1s; -webkit-transition-duration: 1s, 3s; -webkit-transition-property: top, left; background: red; left: 0; position: relative; top: 0; width: 20%;&quot;&gt;
This element transitions the change of top value, but delays the transition on the change of left value for .5s.&lt;/div&gt;
&lt;/div&gt;
&lt;pre&gt; transition-property: top, left;
 transition-duration: 2s, 1.5s;
 transition-delay: .5s, 0s;
&lt;/pre&gt;
&lt;h4 id=&quot;transition-browser-support&quot;&gt;
Browser Support and Backwards Compatibility&lt;/h4&gt;
So, having introduced such a mouthwatering prospect for designers, just how useable is it today? In fact, surprisingly so. &lt;a href=&quot;http://caniuse.com/#search=transitions&quot;&gt;All modern browsers support transitions&lt;/a&gt;, including &lt;span class=&quot;caps&quot;&gt;IE10&lt;/span&gt;
 developer previews. Firefox has done so since version 4, Safari since 
3.2, Chrome since at least version 9, Opera since 10.6, iOS since 3.2 
and Android since 2.1.&lt;br /&gt;
It does need to be noted that not all browsers animate all property changes — we’ll look at this in a little &lt;a href=&quot;http://www.webdirections.org/blog/let-the-web-move-you-css3-animations-and-transitions/#supported-properties&quot;&gt;more detail in the animations section&lt;/a&gt;, since the list of properties applies to both animations and transitions.&lt;br /&gt;
However,
 as yet, all browsers require vendor prefixes in front of all the 
properties for transitions — which can make for some unwieldy &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;.&lt;br /&gt;
Since
 transitions only animate changes in style that are triggered either by a
 change in state (like hover or focus) or via JavaScript, they are 
effectively backwards compatible to just about any browsers likely to be
 used today. Users of those browsers simply don’t see the intermediate 
steps between one state and the other, merely the abrupt transition 
they’d always have seen. We just need to ensure that in the absence an 
animated transition, no information is lost.&lt;br /&gt;
From a usability and accessibility perspective, we should also be mindful that &lt;a href=&quot;http://en.wikipedia.org/wiki/Photosensitive_epilepsy#Web_design&quot;&gt;flashing content can trigger seizures&lt;/a&gt;
 in some users, and that sudden movements of content (for example a 
block of content from one place to another) in the absence of an 
animated transition may be disorienting, particularly for users with 
cognitive disabilities.&lt;br /&gt;
Transitions are straightforward to use, 
widely supported, backwards compatible, and can add a little more to 
your site or application. However just make sure you don’t overdo them. 
Remember the &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt;.&lt;br /&gt;
&lt;h3&gt;
Animations&lt;/h3&gt;
Similar in many ways to transitions, &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Animations allow us to create multi-​​step animated content using only &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; (though we will often want to use just a little JavaScript to trigger the animation).&lt;br /&gt;
I’ve
 mentioned that animations and transitions have a good deal in common — 
here’s a quick look at their similarities and differences.&lt;br /&gt;
&lt;h4&gt;
Similarities between &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Transitions and Animations&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Both animate the change in &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; property values over a period of time&lt;/li&gt;
&lt;li&gt;Both have a duration&lt;/li&gt;
&lt;li&gt;Both have an optional delay&lt;/li&gt;
&lt;li&gt;Both have an optional timing function, defined in the same way&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Differences between &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Transitions and Animations&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Animations can repeat any number of times&lt;/li&gt;
&lt;li&gt;Animations can be specified to go in a forward and reverse direction&lt;/li&gt;
&lt;li&gt;Animations
 can have any number of defined intermediate steps, called “keyframes”, 
but transitions only have a defined start and end “keyframes”.&lt;/li&gt;
&lt;li&gt;With transitions we can specify an animation for any property which changes, using the &lt;code&gt;all&lt;/code&gt; keyword. With animations, we need to specify every property we want animated.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
How &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Animations are defined&lt;/h4&gt;
Creating a &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; animation is a little more work than creating a transition, involving two interlinked steps.&lt;br /&gt;
We need to create a regular &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; rule, which selects the element or elements we want to be animated, and we give this rule a set of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; properties related to animations (we’ll look at these properties in a moment).&lt;br /&gt;
We also create an &lt;code&gt;@keyframes&lt;/code&gt; rule, similar to an &lt;code&gt;@media&lt;/code&gt;
 rule, which defines the two or more keyframes in our animation. If we 
have simply two keyframes, for the beginning and end of our animation, a
 transition is most likely the better choice. Each keyframe specifies 
the state of the animated properties at that particular time during the 
animation.&lt;br /&gt;
While it might sound a little complicated, each step is quite straightforward. Let’s take a look at each in turn.&lt;br /&gt;
&lt;h5&gt;
The animation properties&lt;/h5&gt;
Just as with transitions, we specify various aspects like the duration and timing function of the animation using &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; properties. But first we need to declare which &lt;code&gt;@keyframes&lt;/code&gt; rule will be used to specify the keyframes of our animation, which we do using the &lt;code&gt;animation-name&lt;/code&gt; property. Animation names follow the same rules as &lt;span class=&quot;caps&quot;&gt;HTML4&lt;/span&gt; &lt;code&gt;id&lt;/code&gt;
 values — alphanumeric characters, dashes and underscores, and begin 
with a letter. Here we’re specifying that the header element should be 
animated using an &lt;code&gt;@keyframes&lt;/code&gt; rule with the name opening-​​sequence (we’ll see very shortly how we give @keyframes rules names).&lt;br /&gt;
&lt;pre&gt;header {
 animation-name: opening-sequence;
}&lt;/pre&gt;
&lt;div class=&quot;protip&quot;&gt;
Notice how the &lt;code&gt;animation-name&lt;/code&gt; value is &lt;strong&gt;not&lt;/strong&gt; quoted.&lt;/div&gt;
We’ll return to familiar territory by specifying a duration and timing function for the animation, using the properties &lt;code&gt;animation-duration&lt;/code&gt; and &lt;code&gt;animation-timing-function&lt;/code&gt;.
 As with transitions, the duration is specified in seconds or 
milliseconds, while the timing function takes one of the keywords we saw
 earlier (or again a more complex formula we’ll not go into here).&lt;br /&gt;
&lt;pre&gt;header {
 animation-name: opening-sequence;
 animation-duration: 5s;
 animation-timing-function: ease-in;
}&lt;/pre&gt;
As with transitions, we can also delay the beginning of an animation, here using the &lt;code&gt;animation-delay&lt;/code&gt; property, with a value once again in &lt;code&gt;s&lt;/code&gt; or &lt;code&gt;ms&lt;/code&gt;.&lt;br /&gt;
&lt;pre&gt;header {
 animation-delay: 500ms;
 animation-name: opening-sequence;
 animation-duration: 5s;
 animation-timing-function: ease-in;
}&lt;/pre&gt;
So far, all should be very familiar from transitions. Now we 
meet two new properties. The first is for specifying how often the 
animation runs (once, a certain number of times, or indefinitely). The 
other is for specifying what happens when a repeating animation 
completes — should it begin again from its initial state, or play the 
animation in reverse? Let’s take a look at each.&lt;br /&gt;
Specifying that an animation should run more than once is very straightforward. We use the &lt;code&gt;animation-iteration-count&lt;/code&gt; property, and give it either a numerical value, or the keyword &lt;code&gt;infinite&lt;/code&gt;.
 The animation then runs the specified number of times, or indefinitely.
 The delay in commencing the animation only applies to the very 
beginning of the animation, and there will be &lt;em&gt;no delay between iterations&lt;/em&gt;.&lt;br /&gt;
When
 an animation does run more than once, for example if an element moves 
from left to right on the page, what should happen when the next loop of
 the animation begins? There’s two possibilities. The animation could 
begin where it did the first time — for example on the left, as in this 
example&lt;br /&gt;
&lt;div style=&quot;position: relative;&quot;&gt;
&lt;div id=&quot;normal-animation&quot;&gt;
animation-​​direction: normal;&lt;/div&gt;
&lt;/div&gt;
Or, the animation could reverse direction, returning to the starting values, as the animation below does:&lt;br /&gt;
&lt;div style=&quot;position: relative;&quot;&gt;
&lt;div id=&quot;alternate-animation&quot;&gt;
animation-​​direction: alternate;&lt;/div&gt;
&lt;/div&gt;
We define this behavior using the &lt;code&gt;animation-direction&lt;/code&gt; property, which takes one of two possible keyword values: &lt;code&gt;alternate&lt;/code&gt; or &lt;code&gt;normal&lt;/code&gt;. To achieve the first of the effects above, we use the &lt;code&gt;animation-direction&lt;/code&gt; property with a value of &lt;code&gt;normal&lt;/code&gt;. The second of the two has a value of &lt;code&gt;alternate&lt;/code&gt; for the &lt;code&gt;animation-direction&lt;/code&gt; property.&lt;br /&gt;
Now
 we’ve set up part one of our animation, it’s time to create the 
animation itself. As we’ve mentioned, this is done using an @keyframes 
rule. The form of this rule is:&lt;br /&gt;
&lt;pre&gt;@keyframes opening-sequence {

  0% {
    /*properties to animate*/
  }

  20% {
    /*properties to animate*/
  }

  100% {
    /*properties to animate*/
  }
}&lt;/pre&gt;
That is, we start with the keyword &lt;code&gt;&lt;strong&gt;@keyframes&lt;/strong&gt;&lt;/code&gt;. This is followed by the animation &lt;strong&gt;name&lt;/strong&gt;.
 Next, inside curly braces (}”{“ and ”}”) we have two or more keyframes.
 A keyframe has the form of a percentage value, and then a group of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; properties inside their own curly braces.&lt;br /&gt;
The first keyframe must be 0%, and unlike elsewhere in &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;, the &lt;strong&gt;% is required&lt;/strong&gt;. The last keyframe must be 100%. &lt;span class=&quot;caps&quot;&gt;OK&lt;/span&gt;, so we can use the keyword &lt;code&gt;from&lt;/code&gt; in place of 0% and &lt;code&gt;to&lt;/code&gt; in place of 100%, but both the first and last keyframes must appear.&lt;br /&gt;
To create the animations above, we’d have this @keyframes rule:&lt;br /&gt;
&lt;pre&gt;@keyframes opening-sequence {

  0% {
left: 0%;
  }

  100% {
left: 80%;
  }
}&lt;/pre&gt;
Note how our keyframes rule doesn’t have anything to say about
 the direction, duration, and so on. These are properties we specify for
 particular elements using the animation properties we’ve just seen. 
Both of the animations just above use the same @keyframes rule — they 
just have different &lt;code&gt;animation-direction&lt;/code&gt; properties. Here are the complete rules for each of those animated elements&lt;br /&gt;
&lt;pre&gt;#normal-animation {
background: red;
position: relative;
width: 20%;
animation-name: opening-sequence;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: ease;
&lt;strong&gt;animation-direction: normal;&lt;/strong&gt;
}
&lt;/pre&gt;
&lt;pre&gt;#alternate-animation {
background: red;
position: relative;
width: 20%;
animation-name: opening-sequence;
animation-duration: 5s;
animation-iteration-count: infinite;
animation-timing-function: ease;
&lt;strong&gt;animation-direction: alternate;&lt;/strong&gt;
}
&lt;/pre&gt;
The only difference between the two is the value of the &lt;code&gt;animation-direction&lt;/code&gt; property.&lt;br /&gt;
Let’s take a closer look at the &lt;code&gt;@keyframes&lt;/code&gt; rule. Each keyframe is more or less like a regular &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; rule. In place of a selector like &lt;code&gt;p.classname&lt;/code&gt;,
 it has a percentage value. The percentage value specifies where in the 
animation this keyframe belongs. For example a keyframe percentage of 
40% in a 10&amp;nbsp;second animation occurs after 4&amp;nbsp;seconds.&lt;br /&gt;
It also has a declaration group of properties, separated by semicolons, as we’d find in a regular &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 rule. These define what the appearance of the selected element or 
elements should be at this point in the animation. The browser then 
animates the transitions between these keyframes.&lt;br /&gt;
Rather than go 
on in ever greater detail, perhaps the best way for you to get a better 
understanding of animations is to create some. And you don’t need to 
fire up a text editor, just head over to &lt;a href=&quot;http://westciv.com/tools/animations/&quot;&gt;AnimatR&lt;/a&gt;, the tool I’ve developed to help you create animations. I’ll go into a bit more detail about &lt;a href=&quot;http://www.webdirections.org/blog/let-the-web-move-you-css3-animations-and-transitions/#animatr&quot;&gt;how it works shortly&lt;/a&gt;, but it should make sense if you’ve read this far (and hopefully make more sense of what you have read).&lt;br /&gt;
&lt;h3&gt;
Before and After Animation&lt;/h3&gt;
Suppose we have this &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;header {
 width: 90%;
 animation-name: opening-sequence;
 animation-delay: 2s;
 ...
}&lt;/pre&gt;
And this animation&lt;br /&gt;
&lt;pre&gt;@keyframes opening-sequence {
  0% {
    width: 40%;
  }

  100% {
    width: 60%;
  }
}&lt;/pre&gt;
What width is the element during the 2&amp;nbsp;second delay before the
 animation begins? What about after the animation completes? In both 
cases, it’s 90% (which may not be what you want). But we can specify 
that instead of the applied properties, the opening and closing keyframe
 properties should apply during the animation delay, and after the 
animation completes using the &lt;code&gt;animation-fill-mode&lt;/code&gt; property.&lt;br /&gt;
&lt;code&gt;animation-fill-mode&lt;/code&gt; can take the following keyword values:&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;none&lt;/dt&gt;
&lt;dd&gt;the default state, as described above&lt;/dd&gt;
&lt;dt&gt;forwards&lt;/dt&gt;
&lt;dd&gt;the properties from the 100% keyframe will continue to apply after the animation completes&lt;/dd&gt;
&lt;dt&gt;backwards&lt;/dt&gt;
&lt;dd&gt;the properties from the 0% keyframe apply during the delay period of the animation&lt;/dd&gt;
&lt;dt&gt;both&lt;/dt&gt;
&lt;dd&gt;both the forwards and backwards cases hold&lt;/dd&gt;&lt;/dl&gt;
&lt;h3&gt;
Triggering animations&lt;/h3&gt;
We saw that transitions occur when we change the associated &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; properties, either using &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;,
 or JavaScript. But when do animations occur? An animation will begin as
 soon as a page is loaded, which may not be what we want to occur. 
There’s various ways we can stop the animation auto-​​playing. We could 
not give an &lt;code&gt;animation-name&lt;/code&gt; property to the elements we want
 to animate, and then apply this property using JavaScript when we want 
the animation to commence. But simpler in a way is to use the &lt;code&gt;animation-play-state&lt;/code&gt; property. This takes one of two keywords, &lt;code&gt;running&lt;/code&gt; or &lt;code&gt;paused&lt;/code&gt;. We can change this using JavaScript:&lt;br /&gt;
&lt;pre&gt;element.style-animation-play-state=&quot;running&quot;;&lt;/pre&gt;
Or even trigger an animation to run only when the user is hovering over an element (far from recommended):&lt;br /&gt;
&lt;pre&gt;header {
 animation-play-state: paused;
}

header:hover {
 animation-play-state: running;
}&lt;/pre&gt;
&lt;h4&gt;
Browser Support&lt;/h4&gt;
We were in luck with transitions, as we saw they have widespread support in modern browsers, including &lt;span class=&quot;caps&quot;&gt;IE10&lt;/span&gt;.
 We’re not quite so lucky with animations, but support is definitely on 
the increase. At present, Safari since version 4, Chrome since at least 
9, Firefox since version 5, iOS since 3.2 and Android since 2.1 have 
support for animations. While support in Opera and Internet Explorer 10 
has not been announced, as both these browsers support transitions, 
arguable the hardest part of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; animations to implement, support for animation in these browsers may not be too far off.&lt;br /&gt;
As
 with transitions, all animation properties must currently have vendor 
prefixes: –webkit-​​, –moz– (and so on for future browser support). This
 is also true for &lt;code&gt;@keyframes&lt;/code&gt; rules, but these have a 
slightly unusual format. Typically we prefix the property name, but for 
@keyframes the prefix comes after the &lt;code&gt;@&lt;/code&gt; and before the &lt;code&gt;keyframes&lt;/code&gt; keyword, like so:&lt;br /&gt;
&lt;pre&gt;@-webkit-keyframes{
}

@-moz-keyframes {
}&lt;/pre&gt;
As with transitions, animations will typically be backwards 
compatible, particularly if they are used to add a layer of enhanced 
user experience, rather than content in their own right. One area where 
animations are beginning to see some use is in browser-​​based games. As
 many browsers and devices hardware accelerate animations and 
transitions, for applications where performance is a significant issue, 
as it often is with games, animations will become an increasingly 
attractive solution. But here backwards compatibility is a significant 
issue — with games, animations aren’t simply decoration, they are 
central to the user experience. So, for some time to come, choosing to 
use &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; animation to develop games will necessarily mean excluding some users from playing those games.&lt;br /&gt;
Animations
 also pose a potentially significant challenge to creating accessible 
content. Where sophisticated animations are in essence an important part
 of the content, there is as yet no consensus as to how to make rich 
animations developed using &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; accessible.&lt;br /&gt;
&lt;h3&gt;
Animation (and Transition) Gotchas&lt;/h3&gt;
As
 a technology still in its infancy, animations do have a number of 
gotchas it is worth knowing about, to save hours of hair pulling and 
head-​​on-​​table banging. I’m sure there are many more than this, but 
here are some that I’ve come across.&lt;br /&gt;
&lt;h4 id=&quot;supported-properties&quot;&gt;
Supported properties&lt;/h4&gt;
Not all properties are animated.  A list of properties that can be animated is outlined in &lt;a href=&quot;http://www.w3.org/TR/css3-transitions/#animatable-properties-&quot;&gt;the specification&lt;/a&gt;. Noteworthy is that background images can’t be animated (though properties like &lt;code&gt;background-position&lt;/code&gt; are), with the theoretical exception of gradients (in practice gradients aren’t animated by any browser as yet).&lt;br /&gt;
It’s
 also important to note that transitions and animations only animate 
property transitions which would otherwise occur. For example&lt;br /&gt;
&lt;pre&gt;@keyframes widen {

  0% {
width: 5em;
  }

  100% {
width: 10em;
  }
}&lt;/pre&gt;
won’t animate the width changes of an inline element like an 
&amp;lt;a&amp;gt;, because we can’t set an explicit width on an inline element. 
Similarly, for a paragraph which is statically positioned,&lt;br /&gt;
&lt;pre&gt;@keyframes move {

  0% {
left: 5em;
  }

  100% {
left: 10em;
  }
}&lt;/pre&gt;
won’t animate the element, as we can’t set the position of elements with a &lt;code&gt;position: static&lt;/code&gt;.
 So, if your animation or transition isn’t working, make sure the 
properties make sense. In the case of our link above, we could give it a
 &lt;code&gt;display: inline-block&lt;/code&gt;, while in the case of the paragraph, a &lt;code&gt;position: relative&lt;/code&gt;, and then the animations would take effect.&lt;br /&gt;
&lt;h3&gt;
Animations in the Wild&lt;/h3&gt;
So, just how sophisticated can &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 based animation be? Earlier this year, Naomi Atkinson and Mircea 
Piturca created an opening title sequence for our European conference, 
@media. Here’s a video of it appearing on the big screen, in front of 
hundreds of people in London’s famous Queen Elizabeth Hall:&lt;br /&gt;
&lt;a href=&quot;http://vimeo.com/25355309&quot;&gt;Opening credits at Web Directions @media 2011&lt;/a&gt; from &lt;a href=&quot;http://vimeo.com/user3803770&quot;&gt;Naomi Atkinson&lt;/a&gt; on &lt;a href=&quot;http://vimeo.com/&quot;&gt;Vimeo&lt;/a&gt;.&lt;br /&gt;
Renowned designer and developer Cameron Adams created &lt;a href=&quot;http://www.themaninblue.com/experiment/wds10/titles.htm&quot;&gt;these stunning opening titles for our conference, Web Directions South 2010&lt;/a&gt;.
 Displayed on two enormous screens in a theatre with a capacity of 
1,000, it was an amazing sight to see. Note, this was expressly designed
 for 1024x768 resolution, and uses the font Gotham, so if possible, make
 sure you have the font, and set your screen to that size.&lt;br /&gt;
Perhaps the pre-​​eminent &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Animator to date is &lt;a href=&quot;http://www.anthonycalzadilla.com/&quot;&gt;Anthony Calzadilla&lt;/a&gt;, whose experiments and commercial work have really opened up people to what’s possible with &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; transitions and animations. Well known examples include &lt;a href=&quot;http://animatable.com/demos/madmanimation/&quot;&gt;Madmanimation&lt;/a&gt;, and an animated cover for the &lt;a href=&quot;http://vimeo.com/26096307&quot;&gt;Wired Magazine iPad edition&lt;/a&gt;.&lt;br /&gt;
You’ll also find various collections of animation demonstrations &lt;a href=&quot;http://slodive.com/web-development/best-css3-animation-demos-tutorials/&quot;&gt;like this one&lt;/a&gt;.&lt;br /&gt;
&lt;h3 id=&quot;animatr&quot;&gt;
Introducing AnimatR&lt;/h3&gt;
As &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 becomes ever more powerful and sophisticated, understanding, learning 
and remembering all the associated concepts, property names, syntax and 
so on becomes an ever more onerous job. So, as I am lazy, I’ve developed
 yet another tool, this time to help me (and hopefully you) understand 
and use &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; animations — &lt;a href=&quot;http://westciv.com/tools/animations/&quot;&gt;AnimatR&lt;/a&gt;. AnimatR is not a &lt;span class=&quot;caps&quot;&gt;WYSIWYG&lt;/span&gt; animation tool like Sencha’s slick &lt;a href=&quot;http://www.sencha.com/products/animator/&quot;&gt;Animator&lt;/a&gt;, the eagerly awaited &lt;a href=&quot;http://animatable.com/&quot;&gt;Animatable&lt;/a&gt;, or the just announced &lt;a href=&quot;http://labs.adobe.com/technologies/edge/&quot;&gt;Adobe Edge&lt;/a&gt;.
 Rather, it’s kind of like training wheels, to help you get up to speed 
with the concepts and syntax of animations (or for me a kind of Zimmer 
frame to help me totter along with all these new fangled &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; innovations).&lt;br /&gt;
It helps you easily set up the animation properties (except &lt;code&gt;animation-play-state&lt;/code&gt;),
 as well as the keyframes for your animation. You can also add further 
style for the animated element, for example, giving it a &lt;code&gt;position: absolute&lt;/code&gt; for animating an element’s location (an ever popular pastime).&lt;br /&gt;
To use the code you create with AnimatR, just change the &lt;code&gt;#demo&lt;/code&gt; selector to select the element or elements you want to animate in your pages, and paste the contents of the &lt;strong&gt;code&lt;/strong&gt;
 field into your style sheet. AnimatR will even generate the vendor 
prefixed versions for –moz– and –webkit– browsers (since Opera and &lt;span class=&quot;caps&quot;&gt;IE&lt;/span&gt; have yet to announce support, I’ve not added support for these browsers yet).&lt;br /&gt;
&lt;h3&gt;
Use wisely&lt;/h3&gt;
Right
 now, there’s very little “hotter” in web development than animation, 
shown by the takeoff of Apple’s iAD, and other mobile advertising 
technologies along with tools like Adobe Edge and Sencha Animator. I 
hope you’ll agree they really aren’t all that complex to use, but also 
that they need to be used intelligently. The novelty of stuff on the web
 which flashes and moves has worn off (I hope). It’s time for web based 
animation that is smart and engaging. You have the tools — now get to 
it!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/7211511696680841435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/7211511696680841435' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7211511696680841435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7211511696680841435'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/let-web-move-you-css3-animations-and.html' title='Let the Web move you — CSS3 Animations and Transitions'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-8886155411710366996</id><published>2012-01-02T00:15:00.001-08:00</published><updated>2012-01-02T00:15:44.114-08:00</updated><title type='text'>CSS3 Linear Gradients</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
It’s been a while since we posted anything particularly technical to 
the Web Directions blog, but that’s something we plan on changing. 
Here’s the first in a series of technical articles on &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; features (along with tools to help you lean and use them).&lt;br /&gt;
We’re
 starting with linear gradients. We’ll take a look at where they come 
from, how to use them, and the current level of browser support. 
Ironically although webkit introduced gradients, until version 5.1, 
Safari has supported a different syntax from that described here — so, 
if you are using a version of Safari other than 5.1 (currently in beta) 
you won’t be able to see the examples.&lt;br /&gt;
&lt;h3&gt;
A little history&lt;/h3&gt;
&lt;a href=&quot;http://www.webkit.org/blog/175/introducing-css-gradients/&quot;&gt;webkit first introduced the proposed gradient feature&lt;/a&gt; of &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; way back in 2008, enabling the browser to generate a gradient to be used where images are in &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 — most commonly as a background image, but also potentially for list 
items images, border-​​images, and generated content. Firefox 3.6 
followed suit, but introduced a couple of challenges. It introduced a 
different syntax (now adopted as the proposed &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt;
 gradient syntax), and gradients were only available as background 
images (this restriction is still true today). Not surprisingly, the 
webkit based Chrome supports gradients, as does Opera since version 11.1
 (though only linear gradients (more in a second) are currently 
supported). What of Internet Explorer you ask? Well, &lt;a href=&quot;http://blogs.msdn.com/b/ie/archive/2011/05/04/css3-gradients-in-ie10-platform-preview-1.aspx&quot;&gt;version 10&amp;nbsp;in fact supports gradients&lt;/a&gt;!&lt;br /&gt;
Don’t
 be too alarmed by the two different syntaxes — webkit now supports the 
same syntax as other browsers, as of Safari 5.1 (we’ll also look at how 
to ensure maximum browser compatibility in a moment as well).&lt;br /&gt;
&lt;h3&gt;
How they work&lt;/h3&gt;
Enough
 history, let’s play with them. There are in fact, as mentioned above, 
two kinds of gradients (linear and radial gradients). In this article, 
we’ll focus on linear gradients — and return to radial gradients in an 
upcoming article.&lt;br /&gt;
Gradients aren’t properties (like &lt;code&gt;color&lt;/code&gt;), but are a &lt;strong&gt;computed values&lt;/strong&gt; of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;, something you might not be too familiar with. We use them where we’d typically use a url pointing to an image (most commonly &lt;code&gt;background-image&lt;/code&gt;). In essence, the browser generates an image and uses that.&lt;br /&gt;
Here’s one in action&lt;br /&gt;
&lt;span class=&quot;caps&quot;&gt;OK&lt;/span&gt;, so I’ve cheated a little and added a bit more style, but that subtle gradient is all done with &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;. Try increasing the text size — and see how the background gradient continues to fill the element.&lt;br /&gt;
Here’s what the &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; looks like.&lt;br /&gt;
 &lt;code&gt;background-image: linear-gradient(top, #eff6fb, #d3e4f3 68%);&lt;/code&gt;&lt;br /&gt;
(I
 said don’t panic for a reason — if you are interested in the underlying
 concepts, read on. But if you are a more hands-​​on kind of learner, 
simply head to &lt;a href=&quot;http://westciv.com/tools/gradientsnustyle&quot;&gt;the gradient tool I’ve built&lt;/a&gt;, and start playing.)&lt;br /&gt;
The
 linear-​​gradient starts at the top of the element (we’ll see shortly 
there are other places it can start) and runs vertically to the bottom 
of the element. At the top, the initial color is #eff6fb. At 68% down 
the element, the color is #d3e4f3, and the browser generates a gradient 
image that smoothly transitions from #eff6fb to #d3e4f3. From 68% down 
the element, to its bottom, the color is a solid #d3e4f3.&lt;br /&gt;
&lt;img alt=&quot;gradient in action&quot; height=&quot;200px&quot; src=&quot;http://webdirections.org/images/gradient1.png&quot; /&gt;&lt;br /&gt;
&lt;span class=&quot;caps&quot;&gt;BTW&lt;/span&gt;, “#&lt;code&gt;d3e4f3 68%&lt;/code&gt;” is called a color stop — and gradients can potentially have many stops.&lt;br /&gt;
Before we go on, let’s recap. A gradient is value, starting with the keyword &lt;code&gt;linear-gradient&lt;/code&gt;,
 and then containing a number of values inside parentheses. These values
 specify the direction of the gradient (in this case from top to 
bottom), a starting color, and then one or more color stops. A color 
stop is a color value, with an optional length or percentage value (for 
example, we can have a stop at 1em, 20px and so on).&lt;br /&gt;
Here, for example is a gradient with numerous stops&lt;br /&gt;
&lt;code&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%28%20left,%20%23FF0000,%20%23FFA500%2013.0%25,%23FFFF00%2026.0%25,%230000FF%2039.0%25,%23008000%2052.0%25,%234B0082%2065.0%25,%23EE82EE%2078.0%25%29&quot;&gt;background-image:
 linear-gradient( left, #FF0000, #FFA500 13.0%,#FFFF00 26.0%,#0000FF 
39.0%,#008000 52.0%,#4B0082 65.0%,#EE82EE 78.0%)&lt;/a&gt;&lt;/code&gt;&lt;br /&gt;
&lt;h4&gt;
The gradient direction&lt;/h4&gt;
We
 specify the direction of the gradient in one of two ways. We can 
specify where it starts horizontally with the keywords left and right, 
and vertically with the keywords top and bottom. Let’s look at each of 
these (just follow the link to see each)&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%28top%20,%20#FFFFFF,%20#000000%20%29&quot;&gt;background-​​image: linear-gradient(top , #&lt;span class=&quot;caps&quot;&gt;FFFFFF&lt;/span&gt;, #000000 )&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%28bottom%20,%20%23FFFFFF,%20%23000000%20%29&quot;&gt;background-​​image: linear-gradient(bottom , #&lt;span class=&quot;caps&quot;&gt;FFFFFF&lt;/span&gt;, #000000 )&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%28%20left,%20%23FFFFFF,%20%23000000%20%29&quot;&gt;background-​​image: linear-​​gradient( left, #&lt;span class=&quot;caps&quot;&gt;FFFFFF&lt;/span&gt;, #000000 )&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%28%20right,%20%23FFFFFF,%20%23000000%20%29&quot;&gt;background-​​image: linear-​​gradient( right, #&lt;span class=&quot;caps&quot;&gt;FFFFFF&lt;/span&gt;, #000000 )&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
We can also &lt;strong&gt;combine&lt;/strong&gt; keywords — to create diagonal gradients from the top left, bottom left, top right and bottom right:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%28top%20left,%20%23FFFFFF,%20%23000000%20%29&quot;&gt;background-​​image: linear-gradient(top left, #&lt;span class=&quot;caps&quot;&gt;FFFFFF&lt;/span&gt;, #000000 )&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%28bottom%20left,%20%23FFFFFF,%20%23000000%20%29&quot;&gt;background-​​image: linear-gradient(bottom left, #&lt;span class=&quot;caps&quot;&gt;FFFFFF&lt;/span&gt;, #000000 )&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%28top%20right,%20#FFFFFF,%20#000000%20%29&quot;&gt;background-​​image: linear-gradient(top right, #&lt;span class=&quot;caps&quot;&gt;FFFFFF&lt;/span&gt;, #000000 )&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%28bottom%20right,%20%23FFFFFF,%20%23000000%20%29&quot;&gt;background-​​image: linear-gradient(bottom right, #&lt;span class=&quot;caps&quot;&gt;FFFFFF&lt;/span&gt;, #000000 )&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
But
 gradients would be pretty dull if they could only be horizontal, 
vertical, or diagonal, so there’s a second way to specify the gradient 
direction-​​degrees. (You use keywords or degrees, &lt;strong&gt;not&lt;/strong&gt; both together).&lt;br /&gt;
To specify a gradient angle, we use the format &lt;code&gt;90deg&lt;/code&gt;
 (0deg has the gradient start at the left, 90deg at the bottom, 180deg 
at the right, and 270deg at the top. So, we can think of degrees as 
going counter-​​clockwise from 9&amp;nbsp;o’clock (0deg).)&lt;br /&gt;
As usual, the 
simplest way to understand this is to play with it — so head over to the
 gradient tool I’ve built expressly for this purpose, and vary the angle
 to see what happens.&lt;br /&gt;
&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%28126deg,%20#FF0000,%20#FFA500%2013.0%25,#FFFF00%2026.0%25,#0000FF%2039.0%25,#008000%2052.0%25,#4B0082%2065.0%25,#EE82EE%2078.0%25%29&quot;&gt;&lt;code&gt;background-image:
 linear-gradient(126deg, #FF0000, #FFA500 13.0%,#FFFF00 26.0%,#0000FF 
39.0%,#008000 52.0%,#4B0082 65.0%,#EE82EE 78.0%)&lt;/code&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h4&gt;
Repeating gradients&lt;/h4&gt;
Is your head full of complex stuff yet — color stops, gradient angles, and so on? Well, let’s add to that, with &lt;strong&gt;repeating&lt;/strong&gt; gradients. That’s right, you can repeat a gradient. Here’s how &lt;strong&gt;that&lt;/strong&gt;
 works. If your last color stop is before the “end” of the element (so, 
for example if the gradient goes from left to right, the last stop is 
less than 100% of the width of the element), then the gradient will be 
repeated from the location of the last color stop. If we have a simple 
gradient like this&lt;br /&gt;
&lt;code&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20linear-gradient%280deg,%20%23FF0000,%20%23FFA500%2050%25%29&quot;&gt;background-image: linear-gradient(0deg, #FF0000, #FFA500 50%)&lt;/a&gt;&lt;/code&gt;&lt;br /&gt;
then we change the value name from &lt;code&gt;linear-gradient&lt;/code&gt; to &lt;code&gt;repeating-linear-gradient&lt;/code&gt;, then we’ll have the gradient repeat itself from 50% to 100% of the width of the element, like so&lt;br /&gt;
&lt;code&gt;&lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/#background-image:%20repeating-linear-gradient%280deg,%20%23FF0000,%20%23FFA500%2050%25%29&quot;&gt;background-image: repeating-linear-gradient(0deg, #FF0000, #FFA500 50%)&lt;/a&gt;&lt;/code&gt;&lt;br /&gt;
&lt;h3&gt;
Forget the math, here’s a tool&lt;/h3&gt;
As I mentioned above, there’s no need to remember all the syntax and concepts — as I’ve developed the &lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/index.html&quot;&gt;linear gradient tool&lt;/a&gt;
 to make life easier for you. (In fact I significantly overhauled the 
version I developed something like 2&amp;nbsp;years ago, to provide widespread 
browser support, and support the new syntax more fully.)&lt;br /&gt;
There are some other good gradient tools out there as well, including &lt;a href=&quot;http://www.colorzilla.com/gradient-editor/&quot;&gt;ColorZilla&lt;/a&gt;. I’ve designed this (and &lt;a href=&quot;http://westciv.com/tools/&quot;&gt;my other &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; tools&lt;/a&gt;) to closely follow the concepts of &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; gradients, to be as much a tool for learning, as for producing fine looking gradients.&lt;br /&gt;
It also has some additional features you might like.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;You can tweet a link to a gradient you’ve created by simply clicking a button&lt;/li&gt;
&lt;li&gt;You
 can copy the url of your gradient, and send it to someone via email, 
put it in a link (like I’ve done for many of these examples) or 
otherwise share it&lt;/li&gt;
&lt;li&gt;Via the magic of &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; localStorage, it remembers your most recent gradient, and other settings next time you visit&lt;/li&gt;
&lt;li&gt;It adds vendor prefixes for all modern browsers as an option&lt;/li&gt;
&lt;li&gt;It adds the start color as a background color for older browsers&lt;/li&gt;
&lt;li&gt;There’s a related tool for creating old style Safari gradients&lt;/li&gt;
&lt;li&gt;It provides up to the minute browser compatibility information&lt;/li&gt;
&lt;li&gt;It looks really pretty, all thanks to &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; gradients of course&lt;/li&gt;
&lt;/ul&gt;
So give it a go, and &lt;a href=&quot;http://twitter.com/johnallsopp&quot;&gt;tell me what you think&lt;/a&gt;.&lt;br /&gt;
&lt;h3&gt;
Backwards compatibility&lt;/h3&gt;
Now,
 you might be asking yourself, what about the backwards compatibility 
issues with older browsers and are there any accessibility challenges in
 using gradients? Luckily, gradients are really straightforward to use 
in an accessible, backwards compatible way, across multiple browsers 
provided you keep a couple of things in mind.&lt;br /&gt;
Firstly, ensure you 
have a background color (or image) for the element to ensure color 
contrast with the text. Where gradients aren’t supported, the browser 
will ignore them, and use the color or image.&lt;br /&gt;
At present, all 
browsers require vendor specific extensions for gradient values. The 
gradient tool will create those for you. Make sure that you include a 
gradient value with no vendor extensions, and make this the last of the 
properties you specify (as we know, if &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;, the last property trumps earlier ones in the rule). So for example&lt;br /&gt;
&lt;pre&gt;background-color:#AB1364;
background-image: -moz-linear-gradient(114deg, #AB1364, #52FF26 11%);
background-image: -webkit-linear-gradient(114deg, #AB1364, #52FF26 11%);
background-image: -o-linear-gradient(114deg, #AB1364, #52FF26 11%);
background-image: -ms-linear-gradient(114deg, #AB1364, #52FF26 11%);
background-image: linear-gradient(114deg, #AB1364, #52FF26 11%)&lt;/pre&gt;
For older versions of Safari, we’ll need to have a different &lt;code&gt;background-image&lt;/code&gt; property. Not only is the syntax different, the concepts are too, so you might like to use my &lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/webkit-old-style.html&quot;&gt;old style &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; Linear Gradient generator&lt;/a&gt; to help you out.&lt;br /&gt;
And,
 wth the exception of webkit, gradients are only applicable to 
backgrounds, (webkit browsers support gradients anywhere images are 
used.)&lt;br /&gt;
&lt;h3&gt;
Browser Support Notes&lt;/h3&gt;
A quick summary of current browser support for &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Linear Gradients.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Safari
 4 introduced linear gradients, though as noted with a different syntax 
from that detailed here. The vendor prefix –webkit– is required for 
gradients (e.g. –webkit-​​linear-​​gradient)&lt;/li&gt;
&lt;li&gt;Safari 5.1 
introduces the syntax detailed here, as well as continuing to support 
the older style syntax. Again, the –webkit-​​vendor prefix is required.&lt;/li&gt;
&lt;li&gt;Firefox
 3.6 was the first browser to support the current gradient syntax. The 
–moz– prefix is required, and it’s currently only supported on 
backgrounds.&lt;/li&gt;
&lt;li&gt;Chrome 10 and up (and probably earlier versions) 
supported the syntax for gradients detailed here. The –webkit– prefix is
 required.&lt;/li&gt;
&lt;li&gt;Opera 11.1 introduced linear gradients, once again 
with the vendor prefix, –o– required. Currently gradients are only 
supported on backgrounds.&lt;/li&gt;
&lt;li&gt;Internet Explorer 10 also features &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; gradients, using the prefix –ms-​​, and also only supported on backgrounds.&lt;/li&gt;
&lt;/ul&gt;
And just to make life easy, there is talk at the &lt;span class=&quot;caps&quot;&gt;W3C&lt;/span&gt; &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Working Group of changing the syntax yet again.&lt;br /&gt;
&lt;h3&gt;
More links, examples, and so on&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://leaverou.me/&quot;&gt;Lea Verou&lt;/a&gt; has some great presentations on Gradients, including one at our recent @media conference, which you can &lt;a href=&quot;http://www.webdirections.org/resources/lea-verou-mastering-css3-gradients/&quot;&gt;watch the slides of and listen to&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Lea has also put together a &lt;a href=&quot;http://leaverou.me/css3patterns/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; pattern gallery&lt;/a&gt;, showcasing some amazing designs using &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; gradients&lt;/li&gt;
&lt;li&gt;Estelle Weyl also has a great &lt;a href=&quot;http://www.standardista.com/cssgradients/&quot;&gt;gallery of gradient patterns&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Detailed support information for css gradients, and many other modern &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;, &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; and &lt;span class=&quot;caps&quot;&gt;DOM&lt;/span&gt; features is available at &lt;a href=&quot;http://caniuse.com/#search=gradients&quot;&gt;When Can I Use?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
To do on the Generator&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;At
 present, the generator only supports hex color values. Enabling rgba 
and color keywords (particularly transparent) are important next steps.&lt;/li&gt;
&lt;li&gt;Support for multiple background gradients on a single element, used extensively at the &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Gradient Gallery&lt;/li&gt;
&lt;li&gt;Automatic generation of older webkit style syntax.&lt;/li&gt;
&lt;li&gt;Taking requests — &lt;a href=&quot;http://twitter.com/johnallsopp&quot;&gt;let me know&lt;/a&gt; what you’d like to see&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;comments&quot;&gt;
10 responses to “&lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; Linear Gradients”:&lt;/h3&gt;
&lt;ol class=&quot;commentlist&quot;&gt;
&lt;li id=&quot;comment-222244&quot;&gt;&lt;ul class=&quot;meta&quot;&gt;
&lt;li&gt;By:&lt;cite&gt;&lt;a class=&quot;url&quot; href=&quot;http://about.me/jasonfoss&quot; rel=&quot;external nofollow&quot;&gt;Jason Foss&lt;/a&gt;&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;July 2nd, 2011&lt;/li&gt;
&lt;/ul&gt;
&lt;img alt=&quot;&quot; class=&quot;avatar avatar-65 photo&quot; height=&quot;65&quot; src=&quot;http://1.gravatar.com/avatar/bab9a99c47a2bfdfde62b968d5803292?s=65&amp;amp;d=http%3A%2F%2Fwww.webdirections.org%2Fwp-content%2Fthemes%2Fwebdirections%2Fimages%2Fgravatar.png%3Fs%3D65&amp;amp;r=G&quot; width=&quot;65&quot; /&gt;Thanks John, this clears it right up. They’re actually not &lt;em&gt;that&lt;/em&gt; complicated when explained properly!&lt;br /&gt;
Although
 one has to wonder why the degrees implementation starts at 9&amp;nbsp;o’clock 
and works anti-​​clockwise. I would have thought starting at 12&amp;nbsp;o’clock 
and working clockwise would have been easier to remember. Specifying 
margins and padding works fine that way, why use a different method?&lt;br /&gt;
*shrugs*&lt;/li&gt;
&lt;li id=&quot;comment-222249&quot;&gt;&lt;ul class=&quot;meta&quot;&gt;
&lt;li&gt;By:&lt;cite&gt;&lt;a class=&quot;url&quot; href=&quot;http://css-class.com/&quot; rel=&quot;external nofollow&quot;&gt;Alan Gresley&lt;/a&gt;&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;July 2nd, 2011&lt;/li&gt;
&lt;/ul&gt;
&lt;img alt=&quot;&quot; class=&quot;avatar avatar-65 photo&quot; height=&quot;65&quot; src=&quot;http://1.gravatar.com/avatar/f8d1e42eb1f8db40312f41775502f7f0?s=65&amp;amp;d=http%3A%2F%2Fwww.webdirections.org%2Fwp-content%2Fthemes%2Fwebdirections%2Fimages%2Fgravatar.png%3Fs%3D65&amp;amp;r=G&quot; width=&quot;65&quot; /&gt;Hello John,&lt;br /&gt;
Have
 you been following the recent debates on www-​​style? Firstly the 
angles are changing where 0 degrees indicates the beginning point (first
 color stop) of a gradient which would be positioned at the top 
(northern) part of a box. The &lt;span class=&quot;caps&quot;&gt;WD&lt;/span&gt; did have for 
about 2 week the opposite, where 0 degrees indicated the ending point 
(last color stop) of a gradient. This was also affecting top and bottom 
which the &lt;span class=&quot;caps&quot;&gt;WD&lt;/span&gt; was saying were the referencing the ending points. Now it’s been marked as a &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; issue as mentioned two days ago on the &lt;a href=&quot;http://lists.w3.org/Archives/Public/www-style/2011Jun/0716.html&quot; rel=&quot;nofollow&quot;&gt;www-​​style mailing list&lt;/a&gt; and in the &lt;a href=&quot;http://dev.w3.org/csswg/css3-images/#linear-gradients&quot; rel=&quot;nofollow&quot;&gt;&lt;span class=&quot;caps&quot;&gt;WD&lt;/span&gt;&lt;/a&gt; (in red text).&lt;br /&gt;
Another
 thing that could be happening is how gradients with color with alpha 
transparency work. Some want interpolation in premultiplied space where 
others (one being me) are saying that gradients should work as they do 
now which is that interpolation happens in un-​​premultiplied space. I 
am currently working with an implementer to explore the consequence of 
such a change since they are testing in an implementation (browser) that
 supports interpolation in premultiplied space. Certain gradients are 
broken (look wrong).&lt;br /&gt;
I tried to alert other authors recently but 
no one seems to know what I am talking about. The truth is, only a few 
understand the difference between premultiplied space and 
un-​​premultiplied space. I can explain it quickly but it’s very hard to
 do in typed words.&lt;br /&gt;
I myself would like the issued resolved since I
 have been working on gradients transitions (animations) where some 
color stops are partly transparent. Such a &lt;a href=&quot;http://css-class.com/test/css/3/edge/gradient-animations.htm&quot; rel=&quot;nofollow&quot;&gt;demo&lt;/a&gt;.&lt;/li&gt;
&lt;li id=&quot;comment-222265&quot;&gt;&lt;ul class=&quot;meta&quot;&gt;
&lt;li&gt;By:&lt;cite&gt;Joni&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;July 5th, 2011&lt;/li&gt;
&lt;/ul&gt;
&lt;img alt=&quot;&quot; class=&quot;avatar avatar-65 photo&quot; height=&quot;65&quot; src=&quot;http://1.gravatar.com/avatar/10f872090e76d7130be884c27e9559d5?s=65&amp;amp;d=http%3A%2F%2Fwww.webdirections.org%2Fwp-content%2Fthemes%2Fwebdirections%2Fimages%2Fgravatar.png%3Fs%3D65&amp;amp;r=G&quot; width=&quot;65&quot; /&gt;Also
 rememeber that if you put these to body/​html element (or any big 
element), older machines doesn’t like that so much.. :) it slows down 
scrolling heavily. Specially with fixed background. I haven’t tested 
with small elements, like buttons etc.&lt;/li&gt;
&lt;li id=&quot;comment-222396&quot;&gt;&lt;ul class=&quot;meta&quot;&gt;
&lt;li&gt;By:&lt;cite&gt;&lt;a class=&quot;url&quot; href=&quot;http://www.webdirections.org/blog/css3-radial-gradients/&quot; rel=&quot;external nofollow&quot;&gt;CSS3 Radial Gradients | Web Directions&lt;/a&gt;&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;July 19th, 2011&lt;/li&gt;
&lt;/ul&gt;
[…] 19, 2011 Leave a response Getting your head around &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; radial gradientsWe recently took a detailed look at linear gradients in &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt;. If you’ve not read that, you might like to spend a few minutes doing so, as the concepts are […]&lt;/li&gt;
&lt;li id=&quot;comment-222755&quot;&gt;&lt;ul class=&quot;meta&quot;&gt;
&lt;li&gt;By:&lt;cite&gt;fjpoblam&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;September 13th, 2011&lt;/li&gt;
&lt;/ul&gt;
&lt;img alt=&quot;&quot; class=&quot;avatar avatar-65 photo&quot; height=&quot;65&quot; src=&quot;http://0.gravatar.com/avatar/cb2b050f22477d1c82a204b5704de5b6?s=65&amp;amp;d=http%3A%2F%2Fwww.webdirections.org%2Fwp-content%2Fthemes%2Fwebdirections%2Fimages%2Fgravatar.png%3Fs%3D65&amp;amp;r=G&quot; width=&quot;65&quot; /&gt;Good
 article, John. I’ve been using the *old* (proprietary) formats for 
quite awhile as my main website background. Before that, I was using a 
simple tiled 2px by 800px gradient.&lt;br /&gt;
Perhaps I misunderstood, but I *thought* your implication was that the new (5.1+) Safari supported the new format.&lt;br /&gt;
&lt;span class=&quot;caps&quot;&gt;FWIW&lt;/span&gt;,
 I tried your new format, on MacOSX 10.6.8 (Snow Leopard), in both 
Safari 5.1 (6534.50) and the latest Webkit nightly (r94932), with no 
luck. (My website is coded in “&lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt;”, if that makes a difference.) Therefore, I’ve returned to the proprietaries: –moz, –o, and –webkit.&lt;br /&gt;
It is curious that your demo shows up correctly in both Safaris, though I didn’t take the time to try it out in &lt;span class=&quot;caps&quot;&gt;FF&lt;/span&gt;, Chrome, Camino, or Opera. I don’t know whether you’re using the new spec “behind the scenes” or just an illustrative graphic.&lt;/li&gt;
&lt;li class=&quot;emphasised-comment&quot; id=&quot;comment-222770&quot;&gt;&lt;ul class=&quot;meta&quot;&gt;
&lt;li&gt;By:&lt;cite&gt;&lt;a class=&quot;url&quot; href=&quot;http://www.westciv.com/&quot; rel=&quot;external nofollow&quot;&gt;John&lt;/a&gt;&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;September 17th, 2011&lt;/li&gt;
&lt;/ul&gt;
&lt;img alt=&quot;&quot; class=&quot;avatar avatar-65 photo&quot; height=&quot;65&quot; src=&quot;http://0.gravatar.com/avatar/85c3c5caa031176bc6abeea752a69e35?s=65&amp;amp;d=http%3A%2F%2Fwww.webdirections.org%2Fwp-content%2Fthemes%2Fwebdirections%2Fimages%2Fgravatar.png%3Fs%3D65&amp;amp;r=G&quot; width=&quot;65&quot; /&gt;Safari  5.1 supports both the old and new formats. but &lt;span class=&quot;caps&quot;&gt;AFAIK&lt;/span&gt;, you sat still need –webkit– for Safari 5/.1 and the new formats&lt;/li&gt;
&lt;li id=&quot;comment-222786&quot;&gt;&lt;ul class=&quot;meta&quot;&gt;
&lt;li&gt;By:&lt;cite&gt;&lt;a class=&quot;url&quot; href=&quot;http://www.webdirections.org/blog/2d-transforms-in-css3/&quot; rel=&quot;external nofollow&quot;&gt;2D Transforms in CSS3 | Web Directions&lt;/a&gt;&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;September 21st, 2011&lt;/li&gt;
&lt;/ul&gt;
[…] make rotating an element easy.The rotate function takes an angle value. If you’ve worked with &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; linear gradients, in particular the newer syntax, then you’ll have seen angle units before. There are several ways […]&lt;/li&gt;
&lt;li id=&quot;comment-222864&quot;&gt;&lt;ul class=&quot;meta&quot;&gt;
&lt;li&gt;By:&lt;cite&gt;&lt;a class=&quot;url&quot; href=&quot;http://www.kabayview.com/html5/css3-radial-gradients&quot; rel=&quot;external nofollow&quot;&gt;CSS3 Radial Gradients | kabayview.com&lt;/a&gt;&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;October 6th, 2011&lt;/li&gt;
&lt;/ul&gt;
[…] recently took a detailed look at linear gradients in &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt;. If you’ve not read that, you might like to spend a few minutes doing so, as the concepts are […]&lt;/li&gt;
&lt;li id=&quot;comment-222885&quot;&gt;&lt;ul class=&quot;meta&quot;&gt;
&lt;li&gt;By:&lt;cite&gt;&lt;a class=&quot;url&quot; href=&quot;http://www.kabayview.com/css3/css/cascading-style-sheets-reference-links&quot; rel=&quot;external nofollow&quot;&gt;Cascading Style Sheets Reference Links | kabayview.com&lt;/a&gt;&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;October 10th, 2011&lt;/li&gt;
&lt;/ul&gt;
[…] &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; Linear Gradients – John Allsopp […]&lt;/li&gt;
&lt;li id=&quot;comment-223216&quot;&gt;&lt;ul class=&quot;meta&quot;&gt;
&lt;li&gt;By:&lt;cite&gt;&lt;a class=&quot;url&quot; href=&quot;http://steveworley.me/2011/11/07/css3-and-gradients-%e2%80%94-brief-introduction/&quot; rel=&quot;external nofollow&quot;&gt;CSS3 and gradients — brief introduction « Steve Worley&lt;/a&gt;&lt;/cite&gt;&lt;/li&gt;
&lt;li&gt;December 8th, 2011&lt;/li&gt;
&lt;/ul&gt;
[…] &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt;
 Linear Gradients | Web Directions (webdirections​.org)     
LD_AddCustomAttr(“AdOpt”, “1”); LD_AddCustomAttr(“Origin”, “other”); 
LD_AddCustomAttr(“theme_bg”, “ffffff”); LD_AddCustomAttr(“theme_border”,
 “f1f1f1”); LD_AddCustomAttr(“theme_text”, “555555”); 
LD_AddCustomAttr(“theme_link”, “059bff”); LD_AddCustomAttr(“theme_url”, 
“e5f2bf”); LD_AddCustomAttr(“LangId”, “1”); LD_AddCustomAttr(“Autotag”, 
“science”); LD_AddCustomAttr(“Autotag”, “technology”); 
LD_AddCustomAttr(“Tag”, “web-​​development”); LD_AddCustomAttr(“Tag”, 
“css”); LD_AddCustomAttr(“Tag”, “css-​​techniques”); 
LD_AddCustomAttr(“Tag”, “css3”); LD_AddCustomAttr(“Tag”, 
“css3-​​gradients”); LD_AddCustomAttr(“Tag”, “gradients”); 
LD_AddCustomAttr(“Tag”, “website-​​design”); 
LD_AddSlot(“wpcom_below_post”); LD_​GetBids();  Share 
this:FacebookStumbleUponDiggTwitterLike this:LikeBe the first to like 
this post. […]&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/8886155411710366996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/8886155411710366996' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/8886155411710366996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/8886155411710366996'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/css3-linear-gradients.html' title='CSS3 Linear Gradients'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-1678307951065888943</id><published>2012-01-02T00:14:00.001-08:00</published><updated>2012-01-02T00:14:46.403-08:00</updated><title type='text'>CSS3 Radial Gradients</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h3&gt;
Getting your head around &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt; radial gradients&lt;/h3&gt;
We recently took a &lt;a href=&quot;http://www.webdirections.org/blog/css3-linear-gradients/&quot;&gt;detailed look at linear gradients in &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt;&lt;/a&gt;.
 If you’ve not read that, you might like to spend a few minutes doing 
so, as the concepts are very similar, and I don’t spend quite as much 
time in this article on the fundamentals of gradients which I’ve already
 covered there.&lt;br /&gt;
This time we’ll look in detail at radial 
gradients. If you’ve got a good sense of how linear gradients work, 
radial gradients should present no great difficulty. And, I’ll again 
introduce &lt;a href=&quot;http://westciv.com/tools/radialgradients/&quot;&gt;an updated tool for creating radial gradients&lt;/a&gt;,
 which supports the current syntax, and works across all modern browsers
 which support radial gradients (more on which they are &lt;a href=&quot;http://www.webdirections.org/blog/css3-radial-gradients/#support&quot;&gt;shortly&lt;/a&gt;).&lt;br /&gt;
&lt;h3&gt;
A brief history&lt;/h3&gt;
Like
 linear gradients, radial gradients were first introduced in Webkit in 
2008. Like linear gradients, they are still in a draft &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt;
 specification, and indeed are still in something of a state of flux, so
 it is more than possible the final specified version will be different 
from that described here. As with linear gradients, radial gradients as 
originally proposed by Apple’s Webkit team had a different syntax, and 
quite significantly different conceptual basis from how they are 
currently specified, and from how they are supported in current 
browsers. With Safari 5.1, all modern browsers have harmonized on the 
same syntax, and conceptual basis for radial gradients, which is what we
 cover here. Safari 4, and Chrome 10 and up support a very different 
syntax, and model for radial gradients, which is effectively obsolete, 
and which we won’t cover here.&lt;br /&gt;
&lt;h3&gt;
What exactly &lt;em&gt;is&lt;/em&gt; a radial gradient?&lt;/h3&gt;
I’ve
 thought long and hard about whether to try and explain what is really 
going on with a radial gradient (and for most folks, simply &lt;a href=&quot;http://westciv.com/tools/radialgradients&quot;&gt;playing around with them&lt;/a&gt;
 is likely the best way to really come to grips with them). But, as I’ve
 yet to see a very good description of exactly how radial gradients 
work, here’s my attempt.&lt;br /&gt;
You’ll hopefully remember that linear gradients have a straight &lt;strong&gt;gradient line&lt;/strong&gt;,
 from one edge of the element’s background box. It could be vertically 
from top to bottom, or bottom to top. It could be horizontally from left
 to right, or right to left. Or it could be at an angle, from left to 
right, right to left, upwards or downwards.&lt;br /&gt;
&lt;img alt=&quot;linear gradient lines&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/linearlines.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
Some common linear gradient lines&lt;br /&gt;
We
 then specify two (or more) colors to create the gradient along this 
line. The gradient “smoothly fades” from one color to the next along the
 gradient line.  So, what exactly does “smoothly fades” mean? To get all
 technical on you, the &lt;a href=&quot;http://dev.w3.org/csswg/css3-images/#gradients&quot;&gt;Image Values and Replaced Content module of &lt;span class=&quot;caps&quot;&gt;CSS3&lt;/span&gt;&lt;/a&gt;
 says “between two color-​​stops, the line’s color is linearly 
interpolated between the colors of the two color-​​stops, with the 
interpolation taking place in premultiplied &lt;span class=&quot;caps&quot;&gt;RGBA&lt;/span&gt; space”. Glad you asked? And if you &lt;em&gt;really&lt;/em&gt; want to get down and dirty with linear interpolation, the spec has a &lt;a href=&quot;http://dev.w3.org/csswg/css3-images/#interpolating-gradients&quot;&gt;whole section on it&lt;/a&gt;.&lt;br /&gt;
Radial
 gradients also specify a gradient line, but this time, the line goes 
from the center of an ellipse, outwards in each direction to the edge of
 the ellipse. Along this line color also “fades smoothly” from one color
 stop to the next.&lt;br /&gt;
We also know from linear gradients, that the 
gradient can have intermediate stops between the starting and final 
color. Not surprisingly, radial gradients can have color stops, 
specified as being a certain percentage, or length value, along the 
gradient, between the start and final colors.&lt;br /&gt;
But where radial 
gradients differ significantly from linear ones, is the shape and size 
of the gradient, as well as a gradient’s location.&lt;br /&gt;
In essence, to specify a radial gradient, we give the gradient&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;a location&lt;/li&gt;
&lt;li&gt;a shape&lt;/li&gt;
&lt;li&gt;a size&lt;/li&gt;
&lt;li&gt;one or more color stops&lt;/li&gt;
&lt;/ul&gt;
Let’s
 look at each of these, though slightly out of order, because to 
understand how they all work, we need to understand a little bit about 
what an ellipse is (this won’t hurt a bit I promise).&lt;br /&gt;
&lt;h4&gt;
Ellipses&lt;/h4&gt;
&lt;img alt=&quot;an ellipse&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/ellipse.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
 An Ellipse, showing the major and minor radii.&lt;br /&gt;
An
 ellipse is what we more colloquially call an oval. It differs from a 
circle in that its width and height are different from one another 
(strictly speaking, a circle is a kind of ellipse where the width and 
height are equal).&lt;br /&gt;
&lt;img alt=&quot;circle&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/circle.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 106px;&quot; /&gt;&lt;br /&gt;
As you can see here, a circle is a special kind of ellipse where these two lines are the same length.&lt;br /&gt;
If
 you drop a vertical line through an ellipse at its tallest point, and a
 horizontal line through it  at its widest, where these two intersect is
 the &lt;strong&gt;center&lt;/strong&gt; of the ellipse. The longer of these two 
lines is called the major semi-​​axis or major radius, and the shorter 
the minor semi-​​axis or minor radius.&lt;br /&gt;
From all this, the key concepts to take away are&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;What the center of an ellipse is&lt;/li&gt;
&lt;li&gt;What the radii of an ellipse are&lt;/li&gt;
&lt;/ol&gt;
&lt;h4&gt;
Radial gradient location&lt;/h4&gt;
We give a radial gradient a location by specifying where its &lt;strong&gt;center&lt;/strong&gt;
 will be in relation to the element it is a background image for (we’ll 
leave aside the case where the gradient is used elsewhere for now).&lt;br /&gt;
We
 can specify the location of the ellipse’s center essentially the same 
way we specify the location of a background image with the &lt;code&gt;background-position&lt;/code&gt; &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 property. We specify the horizontal position of the background, and 
optionally the vertical position using either keywords (left, center 
right, or top, center, bottom), length values, percentage values, or 
some combination of these. For example we might have&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;left bottom&lt;/li&gt;
&lt;li&gt;left 100%&lt;/li&gt;
&lt;li&gt;0% bottom&lt;/li&gt;
&lt;li&gt;0% 100%&lt;/li&gt;
&lt;/ul&gt;
Which all specify that the center of the gradient ellipse should be in the left bottom corner of the element background.&lt;br /&gt;
Where the second value is omitted, it is treated as &lt;code&gt;center&lt;/code&gt;
 (similarly, if we omit the first value as well, the center of the 
gradient ellipse is in the center of the element’s background.)&lt;br /&gt;
So, let’s start putting together a radial gradient. As we saw with linear gradients, a gradient is not a &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;
 property. Rather it is a value, that can in theory be used anywhere an 
image would be used, but in practice, typically only as a background 
image on an element. Here we’ll start a radial gradient as the 
background image of an element, and give it a location. We’ll place the 
gradient in the center of the element’s background.&lt;br /&gt;
&lt;pre&gt;background-image: radial-gradient(50% 50%,&lt;/pre&gt;
Notice
 how the horizontal and vertical center values are simply separated by a
 space, and then pair is then followed by a comma. Note too that this is
 not yet a gradient, just the start of one. We still need to specify the
 shape and size, plus its color values.&lt;br /&gt;
&lt;h4&gt;
Radial Gradient shapes and sizes&lt;/h4&gt;
Now
 we’ve specified the location of the center of the gradient, we need to 
specify the shape and size of the ellipse. These can be specified in one
 of two ways, &lt;em&gt;implicitly&lt;/em&gt;, or &lt;em&gt;explicitly&lt;/em&gt;.&lt;br /&gt;
&lt;h5&gt;
Explicit shapes and sizes&lt;/h5&gt;
We
 explicitly specify the shape and size of the ellipse for our radial 
gradient by specifying the lengths of the major and minor radius, using a
 length or percentage value. (as of July 2011, this aspect of radial 
gradients was not supported by any browser, so we’ll only cover this 
briefly).&lt;br /&gt;
For example, we might specify a width of the gradient 
ellipse as being 50% of the width of the background element and 30% of 
the height of the element with the values&lt;code&gt;25% 15%&lt;/code&gt; (note that
 these values specify the radius, which is half the width or height).  
If we specify identical values for width and height, then the two radii 
are the same length, and so we get a circular gradient. Here’s what our 
gradient would look like with this explicitly declared width and height&lt;br /&gt;
&lt;pre&gt;background-image: radial-gradient(50% 50%, 25% 15%,&lt;/pre&gt;
Notice again, the width and height values are separated only by a space, and then we follow these by a comma.&lt;br /&gt;
&lt;h5&gt;
Implicit shapes and sizes&lt;/h5&gt;
Alternatively, instead of specifying an &lt;strong&gt;explicit&lt;/strong&gt; width and height to give us the size and shape of our gradient, we can specify the size and shape &lt;strong&gt;implicitly&lt;/strong&gt;
 with keywords. In practice, this is the only one of the two forms that 
is supported in contemporary browsers, and so is the one you should use.&lt;br /&gt;
&lt;h6&gt;
Shape&lt;/h6&gt;
This part is very straightforward, we just use one of two keywords &lt;code&gt;ellipse&lt;/code&gt; or &lt;code&gt;circle&lt;/code&gt;, to specify the shape of the gradient. So, we create an elliptical shape for our gradient like so&lt;br /&gt;
&lt;pre&gt;background-image: radial-gradient(50% 50%, ellipse&lt;/pre&gt;
Now it’s time to give the gradient a size.&lt;br /&gt;
&lt;h6&gt;
Size&lt;/h6&gt;
If
 we are declaring the size of the gradient implicitly, we specify the 
size of the gradient shape using one of several keywords. Each of these 
keywords specifies an algorithm for giving the gradient a size. These 
algorithms are sometimes slightly different for ellipses and circles. 
While they may initially seem quite complicated, they make sense once 
you understand the key principle of each.  Here’s my way of 
understanding what is going on with each keyword.&lt;br /&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;Keyword&lt;/th&gt;&lt;th&gt;For Circular gradients&lt;/th&gt;&lt;th&gt;For Elliptical Gradients&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;closest-​​side&lt;/td&gt;&lt;td&gt;&lt;img alt=&quot;closest side for circles&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/closestsidecircle.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
with &lt;code&gt;closest-side&lt;/code&gt; a circular gradient is sized so that it “exactly meets the side of the box closest to its center”&lt;/td&gt;&lt;td&gt;&lt;img alt=&quot;closest side ellipse&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/closestsideellipse.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
with &lt;code&gt;closest-side&lt;/code&gt; an ellipse is sized so that it “exactly meets the vertical and horizontal sides of the box closest to its center”&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;closest-​​corner&lt;/td&gt;&lt;td&gt;&lt;img alt=&quot;closest corner ellipse&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/closestcornercircle.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
with &lt;code&gt;closest-corner&lt;/code&gt; a circular gradient is sized so that its &lt;strong&gt;edge&lt;/strong&gt; exactly meets the closest corner to its center of the box&lt;/td&gt;&lt;td&gt;&lt;img alt=&quot;closest corner ellipse&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/closestcornerellipse.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
with &lt;code&gt;closest-corner&lt;/code&gt; an elliptical gradient is sized so that its &lt;strong&gt;edge&lt;/strong&gt; exactly meets the closest corner to its center of the box&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;farthest-​​side&lt;/td&gt;&lt;td&gt;&lt;img alt=&quot;farthest side for circles&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/farthestsidecircle.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
with &lt;code&gt;farthest-side&lt;/code&gt; a circular gradient is sized so that it “exactly meets the side of the box farthest from its center”&lt;/td&gt;&lt;td&gt;&lt;img alt=&quot;farthest side ellipse&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/farthestsideellipse.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
with &lt;code&gt;farthest-side&lt;/code&gt;
 an elliptical gradient is sized so that it “exactly meets the vertical 
and horizontal sides of the box farthest from its center”&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;farthest-​​corner&lt;/td&gt;&lt;td&gt;&lt;img alt=&quot;farthest side ellipse&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/farthestcornercircle.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
with &lt;code&gt;farthest-corner&lt;/code&gt; the gradient-​​shape is sized so that its edge exactly meets the farthest corner from its center of the box&lt;/td&gt;&lt;td&gt;&lt;img alt=&quot;farthest side ellipse&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/farthestcornerellipse.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
with &lt;code&gt;farthest-corner&lt;/code&gt; an elliptical gradient-​​shape is sized so that its edge exactly meets the farthest corner from its center of the box&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
There are two additional keywords, &lt;code&gt;contain&lt;/code&gt; and &lt;code&gt;cover&lt;/code&gt;. The keyword &lt;code&gt;contain&lt;/code&gt; is the same as &lt;code&gt;closest-side&lt;/code&gt;, while the keyword &lt;code&gt;cover&lt;/code&gt; is the same as &lt;code&gt;farthest-corner&lt;/code&gt;.&lt;br /&gt;
Here we’ll give our gradient a size of &lt;code&gt;closest-corner&lt;/code&gt;.&lt;br /&gt;
&lt;pre&gt;background-image: radial-gradient(50% 50%, ellipse closest-corner,&lt;/pre&gt;
As with the location of the center of the gradient, the two keyword values are separated by space, then followed by a commas&lt;br /&gt;
&lt;h4&gt;
Color Stops&lt;/h4&gt;
Now
 we’ve established the size, shape and location of the gradient, all 
that remains is for us to specify two or more color stops. As with 
linear gradients, we specify a color stop with a color, and an optional 
stop position, which is a length or percentage value. The simplest case 
is color values alone.&lt;br /&gt;
When color stops are specified with color 
values only, the stops divide the size of the gradient evenly. So, if 
there are 3 color stops, each color covers a third of the gradient 
shape, and fades into its adjacent color stop(s).&lt;br /&gt;
Let’s take a 
look at an example. Here’s a simple circular gradient. It’s implicitly 
sized to touch the closest size to its center, and has three color 
stops, red, green and blue&lt;br /&gt;
&lt;pre&gt;&lt;a href=&quot;http://westciv.com/tools/radialgradients/index.html#background-image:%20radial-gradient%28center%20center,%20circle%20closest-side,%20%23ff0000,%20%2300ff00,%20%230000ff%20%29&quot;&gt;background-image: radial-gradient(center center, circle closest-side, #ff0000, #00ff00, #0000ff )&lt;/a&gt;&lt;/pre&gt;
Notice how each stop is separated by a comma.&lt;br /&gt;
And here’s what it this will look like in a browser which supports radial gradients.&lt;br /&gt;
&lt;pre&gt;&lt;img alt=&quot;Simple color stops&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/simpleclorstops.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;/pre&gt;
If
 we add more stops, these are simply evenly spaced in the same size, as 
here, where we have 6 color stops, evenly spaced across the size of the 
gradient.&lt;br /&gt;
&lt;pre&gt;&lt;a href=&quot;http://westciv.com/tools/radialgradients/index.html#background-image:%20radial-gradient%28center%20center,%20circle%20closest-side,%20%23ff0000%20,%23ff9f40%20,%23fff81f%20,%23050a99%20,%230b990f%20,%23911c99%20,%23d24fe0%20%29&quot;&gt;background-image: radial-gradient(center center, circle closest-side, #ff0000 ,#ff9f40 ,#fff81f ,#050a99 ,#0b990f ,#911c99 ,#d24fe0 )&lt;/a&gt;&lt;/pre&gt;
&lt;img alt=&quot;six color gradients&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/simpleclorstopsx6.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
Color
 stops can, as we mentioned, optionally also specify a length or 
percentage value. So, we can make color stops a specific distance apart 
from one another, like so:&lt;br /&gt;
&lt;img alt=&quot;percentage gradients&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/percentagegradient.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;a href=&quot;http://westciv.com/tools/radialgradients/index.html#background-image:%20radial-gradient%28center%20center,%20circle%20closest-side,%20%23ff0000%2025%25,%20%2319ff30%2090%25,%20%232f3ced%20100%25%29&quot;&gt;background-image: radial-gradient(center center, circle closest-side, #ff0000 25%, #19ff30 90%, #2f3ced 100%)&lt;/a&gt;&lt;/pre&gt;
Notice again, the color and position of each stop is separated by a space, and again each stop is separated by a comma.&lt;br /&gt;
It’s also possible to use length values, like &lt;code&gt;px&lt;/code&gt; and &lt;code&gt;em&lt;/code&gt;
 in place of percentages, and to mix all three forms of color stop 
(color alone, percentage and lengths).  Keep in mind that percentage 
gradients will adapt to the size of the element, so that when it grows 
or shrinks in size the gradient remains in proportion to the element’s 
size, and so in many cases, percentage gradient stops (or simple color 
stops specified only by color) are likely to be the most adaptable 
choice.&lt;br /&gt;
&lt;h4&gt;
Coloring inside and outside the gradient&lt;/h4&gt;
You might
 have noticed that in our examples, outside the gradient shape is a 
solid color background, the color being that of the last color stop 
specified. Once the gradient completes, whatever the finishing color is 
will then fill the remainder of the element’s background.&lt;br /&gt;
In this last example, you might also have noticed the same thing happens &lt;em&gt;inside&lt;/em&gt;
 the gradient shape. Our first color stop is at 25%, so from the center 
of the gradient to 25% of its width, we have a solid red color. The red 
only fades smoothly into the next color stop, green, from 25% out from 
the gradient shape’s center.&lt;br /&gt;
Stop positions can in fact be greater
 than 100% of the size of the gradient, so we can fill the entire 
element with a gradient by specifying a final stop position large enough
 that the entire element is covered by the gradient.&lt;br /&gt;
&lt;h4&gt;
Repeating gradients&lt;/h4&gt;
As with linear gradients, radial gradients can repeat. This we specify with a slightly different value name — &lt;code&gt;repeating-radial-gradient&lt;/code&gt;. If we take our previous gradient, and repeat it, here’s what we get&lt;br /&gt;
&lt;img alt=&quot;repeating radial gradient&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/repeatingradial.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;a href=&quot;http://westciv.com/tools/radialgradients/index.html#background-image:%20repeating-radial-gradient%28center%20center,%20circle%20closest-side,%20%23ff0000%2025%25,%20%2319ff30%2090%25,%20%232f3ced%20100%25%29&quot;&gt;background-image: repeating-radial-gradient(center center, circle closest-side, #ff0000 25%, #19ff30 90%, #2f3ced 100%)&lt;/a&gt;&lt;/pre&gt;
Where
 we would have solid color outside the gradient shape, we now have the 
gradient repeating. If we reduce the size of the gradient, the effect 
becomes more pronounced. In this example, we reduce the size of the 
gradient shape, to get the following non-​​repeating gradient.&lt;br /&gt;
&lt;img alt=&quot;small radial non repeating gradient&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/smallradialnonrepeating.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;a href=&quot;http://westciv.com/tools/radialgradients/index.html#background-image:%20radial-gradient%28center%20center,%20circle%20closest-side,%20%23ff0000%200%25,%2319ff30%2029%25%29&quot;&gt;background-image: radial-gradient(center center, circle closest-side, #ff0000 0%,#19ff30 29%)&lt;/a&gt;&lt;/pre&gt;
Now if we repeat the gradient, the effect is far more noticeable.&lt;br /&gt;
&lt;img alt=&quot;the same radial gradient repeating&quot; src=&quot;http://westciv.com/images/wdblogs/radialgradients/tightrepeatingradial.png&quot; style=&quot;display: inline-block; float: none; margin: 0 auto; width: 200px;&quot; /&gt;&lt;br /&gt;
&lt;pre&gt;&lt;a href=&quot;http://westciv.com/tools/radialgradients/index.html#background-image:%20repeating-radial-gradient%28center%20center,%20circle%20closest-side,%20%23ff0000%200%25,%2319ff30%2029%25%29&quot;&gt;background-image: repeating-radial-gradient(center center, circle closest-side, #ff0000 0%,#19ff30 29%)&lt;/a&gt;&lt;/pre&gt;
&lt;h3&gt;
Doing the heavy lifting for you&lt;/h3&gt;
Shapes, sizes, centers, radii, stops… If it all sounds like a lot to learn and remember, then again we’re here to help. As &lt;a href=&quot;http://westciv.com/tools/gradientsnustyle/&quot;&gt;we’ve done for linear gradients&lt;/a&gt;, we’ve  built a &lt;a href=&quot;http://westciv.com/tools/radialgradients/&quot;&gt;radial gradient tool&lt;/a&gt;,  which helps you build gradients, without having to remember all the heavy lifting.&lt;br /&gt;
As with our linear gradient tool, in addition to just helping you create radial gradient, it has some other features.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;You can tweet a link to a gradient you’ve created by simply clicking a button&lt;/li&gt;
&lt;li&gt;You
 can copy the url of your gradient, and send it to someone via email, 
put it in a link (like I’ve done for many of these examples) or 
otherwise share it&lt;/li&gt;
&lt;li&gt;Via the magic of &lt;span class=&quot;caps&quot;&gt;HTML5&lt;/span&gt; localStorage, it remembers your most recent gradient, and other settings next time you visit&lt;/li&gt;
&lt;li&gt;It adds vendor prefixes for all modern browsers (as an option)&lt;/li&gt;
&lt;li&gt;It adds the start color as a background color for older browsers&lt;/li&gt;
&lt;li&gt;There’s a related tool for creating old-​​style Webkit gradients&lt;/li&gt;
&lt;li&gt;It provides up to the minute browser compatibility information (provided I remember to update that as browsers change)&lt;/li&gt;
&lt;li&gt;It looks really pretty, all thanks to &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; gradients of course&lt;/li&gt;
&lt;/ul&gt;
So &lt;a href=&quot;http://westciv.com/tools/radialgradients/&quot;&gt;give it a try&lt;/a&gt;, and let us know what you think.&lt;br /&gt;
&lt;h3&gt;
Browser Compatibility&lt;/h3&gt;
Despite
 being relatively new, and as yet not completely specified, radial 
gradients are safe to use in a way that is backwards compatible, and are
 in fact quite widely supported (we’ll take a look at which browsers 
support them &lt;a href=&quot;http://www.webdirections.org/blog/css3-radial-gradients/#support&quot;&gt;in a moment&lt;/a&gt;).&lt;br /&gt;
To ensure compatibility and accessibility when using radial gradients, as with linear gradients, it’s important to&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;include vendor specific prefixes (-o-​​, –ms-​​, –moz, –webkit-​​), as well as the standard form of gradient values&lt;/li&gt;
&lt;li&gt;include
 a background color for browsers which don’t support gradients. Make 
sure the text of an element with a gradient background has sufficient 
contrast with the element’s background color&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;support&quot;&gt;
Browser support&lt;/h4&gt;
A quick summary of current browser support for &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Radial Gradients (based on the information at the fantastic &lt;a href=&quot;http://caniuse.com/#search=gradients&quot;&gt;When Can I Use&lt;/a&gt;).&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Safari
 4 introduced radial gradients, though as noted with a different syntax 
from that detailed here. The vendor prefix –webkit– is required for 
gradients in Safari 4.1 and newer.&lt;/li&gt;
&lt;li&gt;Safari 5.1 introduces the 
syntax detailed here, as well as continuing to support the older style 
syntax. Again, the –webkit– vendor prefix is required.&lt;/li&gt;
&lt;li&gt;Firefox 
3.6 was the first browser to support the current gradient syntax. The 
–moz– prefix is required, and it’s currently only supported on 
backgrounds.&lt;/li&gt;
&lt;li&gt;Chrome 10 and up (and probably earlier versions) 
supported the syntax for gradients detailed here. The –webkit– prefix is
 required.&lt;/li&gt;
&lt;li&gt;Opera 11.1 introduced linear gradient support, but at present does not support radial gradients of any kind&lt;/li&gt;
&lt;li&gt;Internet Explorer 10 also features &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; radial gradients, using the prefix –ms-​​, and also only on backgrounds.&lt;/li&gt;
&lt;/ul&gt;
Gradients
 can be computationally intensive, and may cause browsers running on 
older hardware difficulty. At present they are not able to be animated 
with &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; transitions in any browser which supports transitions.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/1678307951065888943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/1678307951065888943' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/1678307951065888943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/1678307951065888943'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/css3-radial-gradients.html' title='CSS3 Radial Gradients'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-3420166941316852245</id><published>2012-01-02T00:09:00.000-08:00</published><updated>2012-01-02T00:09:24.389-08:00</updated><title type='text'>Get Ready for HTML 5</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;title&gt;A List Apart: Articles: Get Ready for HTML 5&lt;/title&gt;
  
 
 &lt;link href=&quot;http://www.alistapart.com/site/rss&quot; rel=&quot;alternate&quot; title=&quot;A List Apart main RSS feed&quot; type=&quot;application/rss+xml&quot;&gt;&lt;/link&gt;
 &lt;link href=&quot;/css/print.css&quot; media=&quot;print&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
 &lt;link href=&quot;/css/article.css&quot; media=&quot;all&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt;
 &lt;style type=&quot;text/css&quot;&gt;
  @import url(/css/291.css);
 
&lt;/style&gt;

 
     &lt;style type=&quot;text/css&quot;&gt;
    .ok {
        background-color: #00ff00;
    }
    
&lt;/style&gt;
    &lt;script src=&quot;/d/get-ready-for-html-5/webforms/webforms2-p.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
  
  &lt;script type=&quot;text/javascript&quot;&gt;
  // &lt;![CDATA[  
    function show_ok()
    {
        var obj = document.getElementById(&quot;ok&quot;);
        obj.style.display = &quot;inline&quot;;
        window.setTimeout(&quot;hide_ok();&quot;, 2000);
    }
    
    function hide_ok()
    {
        var obj = document.getElementById(&quot;ok&quot;);
        obj.style.display = &quot;none&quot;;
    }

    function changeMax()
    {
        var shapeType = document.getElementById(&quot;shapeType&quot;).value;
        var obj = document.getElementById(&quot;shapeSize&quot;);
        obj.getAttributeNode(&#39;max&#39;).value = (shapeType == 0) ? 60 : 120;
    }
    
    function drawShape() {
        var width = 270;
        var height = 135;
            
        var canvas = document.getElementById(&quot;shapeCanvas&quot;);
        
        var xPos; /* current X position */
        var yPos;
        var size;
        var shapeType = document.getElementById(&quot;shapeType&quot;).value;
        if (canvas.getContext) {
            var ctx = canvas.getContext(&quot;2d&quot;);
            size = parseInt(document.getElementById(&quot;shapeSize&quot;).value, 10);
            xPos = Math.floor(width / 2);
            yPos = Math.floor(height / 2);
            ctx.fillStyle = &quot;#&quot; + document.getElementById(&quot;shapeColor&quot;).value;
            ctx.clearRect(0, 0, width, height);
            ctx.beginPath();
            if (shapeType == 0)
            {
                ctx.arc(xPos, yPos, size, 0, 2*Math.PI, true);
            }
            else if (shapeType == 1)
            {
                xPos -= size / 2;
                yPos -= size / 2;
                ctx.moveTo(xPos, yPos);
                ctx.lineTo(xPos + size, yPos);
                ctx.lineTo(xPos + size, yPos + size);
                ctx.lineTo(xPos, yPos + size)
            }
            else
            {
                yPos -= size / 2;
                ctx.moveTo(xPos, yPos);
                ctx.lineTo(xPos + size / 2, yPos + size / 2);
                ctx.lineTo(xPos, yPos + size);
                ctx.lineTo(xPos - size / 2, yPos + size / 2)
            }
            ctx.closePath();
            ctx.fill();
        }
    }
    
    function drawSimpleCanvas()
    {
        var canvas = document.getElementById(&quot;simpleCanvas&quot;);
        if (canvas.getContext)
        {
            var ctx = canvas.getContext(&quot;2d&quot;);
            ctx.fillStyle = &quot;#ff0000&quot;;
            ctx.beginPath();
            ctx.arc(50, 50, 30, 0, 2*Math.PI, true);
            ctx.closePath();
            ctx.fill();
            ctx.save();
            
            // move and resize the octagon
            ctx.translate(100, 20);
            ctx.scale(1.65, 1.65);
            ctx.fillStyle = &quot;#0000ff&quot;;
            ctx.beginPath();
            ctx.moveTo(36, 25); ctx.lineTo(25, 36);
            ctx.lineTo(11, 36);
            ctx.lineTo(0, 25);
            ctx.lineTo(0, 11);
            ctx.lineTo(11, 0);
            ctx.lineTo(25, 0);
            ctx.lineTo(36, 11);
            ctx.closePath();
            ctx.fill();
            
            // get back to normal scaling
            ctx.restore();
            ctx.globalAlpha = 0.5;
            ctx.fillStyle = &quot;#00ff00&quot;;
            ctx.beginPath();
            ctx.rect(60, 20, 60, 60);
            ctx.closePath();
            ctx.fill();
        }
    }
        
    function showData() {
        var width = 270; /* canvas width/height */
        var height = 135;
            
        /* coordinates of leftmost point of the &quot;balance bar&quot; */
        var xBase = Math.floor((width - 200) / 2);
        var yBase = Math.floor(height / 2);
            
        var numbers; /* the raw input numbers */
        var max;
        var min;
        var mean = 0;
            
        var freq = new Array(); /* Frequency of each of the items in the data */
        var n = 0; /* number of non-NaN items */
        var maxFreq = 0; /* maximum frequency (used to plot highest bar) */
    
        var canvas = document.getElementById(&quot;centroid&quot;);
            
        var xPos; /* current X position */
        var item; /* utility variable for scanning through the numbers array */
        
        if (canvas.getContext) {
            var ctx = canvas.getContext(&quot;2d&quot;);
            numbers = document.getElementById(&quot;itemData&quot;).value.split(/,|,?\s+/);
            min = parseInt(numbers[0], 10);
            max = parseInt(numbers[0], 10);
            for (var i = 0; i &lt; numbers.length; i++)
            {
                item = parseInt(numbers[i], 10);
                if (!isNaN(item))
                {
                    mean += item;
                    if (item &gt; max)
                    {
                        max = item;
                    }
                    if (item &lt; min)
                    {
                        min = item;
                    }
                    /* Keep this as a hash indexed by string! */
                    freq[numbers[i]] =  (freq[numbers[i]] == null) ? 1 : freq[numbers[i]] + 1;
                    if (freq[numbers[i]] &gt; maxFreq)
                    {
                        maxFreq = freq[numbers[i]];
                    }
                    n++;
                }
            }
            ctx.fillStyle = &quot;rgb(255, 255, 255)&quot;;
            ctx.strokeStyle = &quot;rgb(0, 0, 0)&quot;;
            ctx.fillRect (0, 0, width, height);
            ctx.strokeRect (0, 0, width, height);
            if (n &gt; 0)
            {
                mean = mean / n;
                ctx.beginPath();
                ctx.moveTo(xBase, yBase);
                ctx.lineTo(200 + xBase, yBase );
                ctx.closePath();
                ctx.stroke();
                
                ctx.fillStyle = &quot;rgb(0, 200, 0)&quot;
                for (var entry in freq)
                {
                    item = parseInt(entry, 10);
                    xPos = (max != min) ? Math.floor(198 * (item - min) / (max - min))
                        : 100;
                        
                    /* draw the labeled bar */
                    height = Math.floor(40 * freq[entry]/maxFreq);
                    ctx.fillRect(xBase + xPos, yBase - height, 2, height);
                    width = ctx.measureText(entry).width;
                    ctx.fillText(entry, xBase + xPos - width / 2, yBase - (height + 4));
                }
                    
                mean = Math.floor(mean * 100) / 100;
                    
                /* Draw the &quot;fulcrum&quot; of the balance beam */
                xPos = (max != min) ?  xBase + 198 * (mean-min)/(max-min) : xBase + 100;
                ctx.fillStyle = &quot;rgb(255, 0, 0)&quot;;
                ctx.beginPath();      
                ctx.moveTo(xPos, yBase + 1);
                ctx.lineTo(xPos - 7, yBase + 14)
                ctx.lineTo(xPos + 7, yBase + 14)
                ctx.closePath();
                ctx.fill();
                width = ctx.measureText(mean).width;
                ctx.fillText(mean, xPos - width / 2, yBase + 30)
            }
            else
            {
                ctx.fillStyle = &quot;rgb(0, 0, 0)&quot;
                ctx.font = &quot;16px sans-serif&quot;
                item = &quot;No data to plot.&quot;
                ctx.fillText(item, width / 2 - ctx.measureText(item).width / 2, yBase); 
            }
        }
    }
// ]]&gt;
 
&lt;/script&gt;
  
  &lt;style media=&quot;screen&quot; type=&quot;text/css&quot;&gt;
  .working-sample { margin:3.5em 0 3.5em 0;}
 
&lt;/style&gt;
 


 


&lt;br /&gt;
&lt;div id=&quot;main&quot;&gt;
&lt;div class=&quot;column&quot; id=&quot;content&quot;&gt;
&lt;h1 class=&quot;title&quot;&gt;
Get Ready for HTML&amp;nbsp;5&lt;/h1&gt;
&lt;div id=&quot;articletext&quot;&gt;
&lt;div class=&quot;illustration left full&quot;&gt;
&lt;/div&gt;
With support in Chrome, Firefox 3.5, Opera, and Safari, HTML 5 is &lt;a href=&quot;http://www.imdb.com/title/tt0082193/&quot;&gt;coming at you&lt;/a&gt; like a &lt;a href=&quot;http://www.imdb.com/title/tt0089941/&quot;&gt;runaway train&lt;/a&gt;. Here are some suggestions to help you prepare to get on board rather than be left at the platform or tied to the tracks.&lt;br /&gt;
&lt;h2&gt;
See what others have done&lt;/h2&gt;
The first thing you can do to prepare for HTML 5 is see how other people are using it. A visit to the &lt;a href=&quot;http://html5gallery.com/&quot;&gt;HTML 5 gallery&lt;/a&gt; will show you how several sites are already using the new HTML 5 elements. Use the source, Luke!&lt;br /&gt;
&lt;h2&gt;
Now you do it&lt;/h2&gt;
You can look at the sites, read all the articles &lt;a href=&quot;http://www.alistapart.com/articles/previewofhtml5/&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://html5doctor.com/&quot;&gt;elsewhere&lt;/a&gt;, and even &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/&quot;&gt;read the specification&lt;/a&gt;—but none of that will help you understand HTML 5 as much as &lt;i&gt;using&lt;/i&gt; the new elements. You can modify part of an existing site or experiment by creating new pages. I did this myself by &lt;a href=&quot;http://langintro.com/hamburg5/&quot;&gt;updating a trip report I made for friends and family&lt;/a&gt;. (I never intended it for public display, but here it is.)&lt;br /&gt;
By doing this, you’ll find out what works and what doesn’t. For example, I discovered that, as of this writing, Firefox 3.5 treats elements like &lt;code&gt;article&lt;/code&gt; and &lt;code&gt;section&lt;/code&gt; as &lt;code&gt;display:inline&lt;/code&gt;, and I had to explicitly set them to &lt;code&gt;display:block&lt;/code&gt; to make them work as expected.&lt;br /&gt;
&lt;h2&gt;
X marks the spot&lt;/h2&gt;
If you are like most designers, you probably don’t write all your markup by hand. But until the tools you use catch up to the new elements in (X)HTML 5, you will be doing some markup by hand while you learn. There’s been a bit of confusion (and controversy!) about the relationship between HTML 5, XHTML 1.0/1.1, and XHTML 5. Let’s clear that up right now.&lt;br /&gt;
HTML 4.0 (the markup language we all know and love) is based on a “rulebook” called SGML. In the SGML rulebook, element names are not case sensitive, you can have elements with optional closing tags (like &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;), and you can have attribute values without quotation marks. XHTML 1.0 and 1.1 are based on a rulebook called XML. In the XML rulebook, element and attribute names &lt;i&gt;are&lt;/i&gt; case sensitive, every opening tag &lt;i&gt;must&lt;/i&gt; have a closing tag, and attribute values &lt;i&gt;must&lt;/i&gt; be quoted.&lt;br /&gt;
HTML 5 defines a markup language that isn’t based on either rulebook, but that can be written in either “HTML form” (or serialization, as the spec calls it) or  “XHTML form.”&lt;br /&gt;
When you write markup in HTML form, you are allowed to leave off some closing (and opening!) tags, you don&#39;t have to quote attribute values if they don’t contain blanks, and element and attribute names aren’t case sensitive. You also get to use some of the XML markup; you can have a trailing slash on elements like &lt;code&gt;&amp;lt;img /&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;hr /&amp;gt;&lt;/code&gt;.&lt;br /&gt;
When you use the XHTML serialization, you have to follow the XML rules mentioned a few paragraphs ago.&lt;br /&gt;
I suggest that you write your markup in XHTML 5, or, if you use HTML 5, do the markup as if it were XHTML. You will be better off staying with the XML standard that requires a closing tag for each opening tag rather than spending your time optimizing markup for tags that have optional closing and/or opening tags. Similarly, quote all your attribute values rather than trying to decide when you can leave the quotes off. In addition to not having to waste neurons on those decisions, your markup will be more consistent.&lt;br /&gt;
Once the automatic markup generation tools catch up, you may still want them to generate XHTML 5 rather than HTML 5. Use of XML is forward-looking; its namespaces allow you to have “polyglot documents” that consist of multiple markups beyond the RDFa, MathML, and SVG of HTML 5. You can also use tools such as &lt;a href=&quot;http://www.w3.org/Style/XSL/&quot;&gt;XPath, XSLT, and XQuery&lt;/a&gt; on XML-based markup, using any XML parser of your choice (though there is &lt;a href=&quot;http://about.validator.nu/htmlparser/&quot;&gt;a Java-based parser&lt;/a&gt; that will process plain HTML 5).&lt;br /&gt;
Of course, it’s not all good news. If you do go with XHTML 5, remember that your server &lt;i&gt;must&lt;/i&gt; deliver the documents with a MIME type of &lt;code&gt;application/xhtml+xml&lt;/code&gt; or &lt;code&gt;text/xml&lt;/code&gt;. This may involve negotiation with your hosting service. Also, when you deliver an XML file, any syntax error will cause an error message.&lt;br /&gt;
&lt;div class=&quot;illustration full left&quot;&gt;



&lt;img alt=&quot;Screenshot of XML parse error for mismatched tags&quot; src=&quot;http://www.alistapart.com/d/get-ready-for-html-5/error_message.png&quot; /&gt;
&lt;br /&gt;
Fig. 1. XML parse error for mismatched tags.&lt;/div&gt;
If you are doing markup by hand, think of these error messages as a way to keep you honest. If you are using tools that create XHTML, there is no problem; the tools should always produce well-formed XML.&lt;br /&gt;
&lt;h2&gt;
Regular expressions&lt;/h2&gt;
HTML 5 extends the &lt;code&gt;input&lt;/code&gt; element by offering new attributes that allow you to specify what data you will allow as input. These attributes include &lt;code&gt;min&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt; (to set a numeric range), and HTML 5 also offers new values for the &lt;code&gt;type&lt;/code&gt; attribute, such as &lt;code&gt;url&lt;/code&gt;, &lt;code&gt;email&lt;/code&gt;, &lt;code&gt;date&lt;/code&gt;, and &lt;code&gt;time&lt;/code&gt;.&lt;br /&gt;
If none of these new input types suits your needs, HTML 5 provides the &lt;code&gt;pattern&lt;/code&gt; attribute for &lt;code&gt;input&lt;/code&gt; elements with &lt;code&gt;type=&quot;text&quot;&lt;/code&gt;. The value of the &lt;code&gt;pattern&lt;/code&gt; attribute is a regular expression, as defined in &lt;a href=&quot;http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf&quot;&gt;ECMAScript&lt;/a&gt; and used in JavaScript. Regular expressions are a concise and perhaps somewhat cryptic way of specifying a pattern of characters. For example, if I want to match a five-digit or nine-digit US ZIP code or a six-character Canadian postal code, I can use this pattern:&lt;br /&gt;
&lt;pre&gt;([0-9]{5}(-[0-9]{4})?)|([A-Z][0-9][A-Z]\s+[0-9][A-Z][0-9])&lt;/pre&gt;
The new web form capabilites are partially implemented in Safari and Chrome, and completely in Opera (see &lt;a href=&quot;http://a.deveria.com/caniuse/#agents=All&amp;amp;eras=All&amp;amp;cats=HTML5&amp;amp;statuses=rec,cr,wd,ietf&quot;&gt;this site&lt;/a&gt; for browser capability information). Don’t worry if your browser does not yet support the &lt;code&gt;form&lt;/code&gt; extensions for HTML 5; you can download &lt;a href=&quot;http://code.google.com/p/webforms2/&quot;&gt;Google’s Web Forms 2&lt;/a&gt; and off you go!&lt;br /&gt;
Here is a sample form that validates a date and a postal code:&lt;br /&gt;
&lt;div class=&quot;working-sample&quot;&gt;
&lt;form action=&quot;javascript:show_ok()&quot; id=&quot;validateForm&quot;&gt;
Enter a date: &lt;input name=&quot;day&quot; required=&quot;required&quot; title=&quot;Use format yyyy-mm-dd&quot; type=&quot;date&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Enter a US ZIP Code or Canadian Postal Code:
    &lt;input name=&quot;postCode&quot; pattern=&quot;([0-9]{5}(-[0-9]{4})?)|([A-Z][0-9][A-Z]\s+[0-9][A-Z][0-9])&quot; required=&quot;required&quot; title=&quot;US: 99999-1234; Canadian: A1B 2C3&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;
&lt;input type=&quot;submit&quot; value=&quot;Check Data&quot; /&gt;
&lt;span class=&quot;ok&quot; id=&quot;ok&quot; style=&quot;display: none;&quot;&gt;&amp;nbsp;Valid Data!&amp;nbsp;&lt;/span&gt;&lt;/form&gt;
&lt;/div&gt;
And here is the relevant markup:&lt;br /&gt;
&lt;pre&gt;&amp;lt;p&amp;gt;
Enter a date: &amp;lt;input type=&quot;date&quot; name=&quot;day&quot;
required=&quot;required&quot;
title=&quot;Use format yyyy-mm-dd&quot; /&amp;gt;
&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;
Enter a US or Canadian Postal Code:
&amp;lt;input type=&quot;text&quot; name=&quot;postCode&quot;
required=&quot;required&quot;
pattern=&quot;([0-9]{5}(-[0-9]{4})?)|([0-9][A-Z][0-9]\s+[A-Z][0-9][A-Z])&quot;
title=&quot;US: 99999-1234; Canadian: 0A1&amp;amp;#160;B2C&quot; /&amp;gt;

&amp;lt;/p&amp;gt;
&lt;/pre&gt;
Regular expressions are well worth the time it takes to learn them. Many text editors offer integrated regular expression search-and-replace features, and once you start using them, you’ll wonder how you ever got along without them.&lt;br /&gt;
&lt;h2&gt;
Static art with SVG&lt;/h2&gt;
&lt;div class=&quot;illustration right&quot;&gt;
&lt;img alt=&quot;red circle and blue octagon overlapped by translucent green rectangle&quot; src=&quot;http://www.alistapart.com/d/get-ready-for-html-5/svg_screenshot.png&quot; /&gt;
&lt;br /&gt;
Fig. 2. Image of SVG showing colored shapes.&lt;/div&gt;
If you want the crisp edges of vector-drawn art, HTML 5 allows you to embed &lt;a href=&quot;http://www.w3.org/Graphics/SVG/&quot;&gt;SVG (Scalable Vector Graphics)&lt;/a&gt; in your documents. Putting SVG inline is partially implemented in Firefox, Safari, and Opera, according to &lt;a href=&quot;http://wiki.whatwg.org/wiki/Implementations_in_Web_browsers&quot;&gt;this site&lt;/a&gt;.&lt;br /&gt;
You can already &lt;a href=&quot;http://www.blogger.com/d/get-ready-for-html-5/gatto02.svg&quot;&gt;link to an SVG file&lt;/a&gt; in Firefox 3.5. That graphic is a bit complex—&lt;a href=&quot;http://www.blogger.com/d/get-ready-for-html-5/simple.svg&quot;&gt;here’s a much simpler one&lt;/a&gt; (see Fig. 2) showing some simple colored shapes.&lt;br /&gt;
And here’s the SVG that generates it:&lt;br /&gt;
&lt;pre&gt;&amp;lt;svg xmlns:svg=&quot;http://www.w3.org/2000/svg&quot;
xmlns=&quot;http://www.w3.org/2000/svg&quot; 
viewBox=&quot;0 0 200 100&quot;
width=&quot;200px&quot; height=&quot;100px&quot;&amp;gt;

&amp;lt;circle cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;30&quot;
    style=&quot;stroke:none; fill:#ff0000;&quot;/&amp;gt;

&amp;lt;g transform=&quot;translate(100, 20) scale(1.65)&quot;&amp;gt;
    &amp;lt;polygon points=&quot;36 25, 25 36, 11 36, 0 25,
        0 11, 11 0, 25 0, 36 11&quot;
        style=&quot;stroke:none; fill:#0000ff;&quot; /&amp;gt;
&amp;lt;/g&amp;gt;

&amp;lt;rect x=&quot;60&quot; y=&quot;20&quot; height=&quot;60&quot; width=&quot;60&quot;
    style=&quot;stroke:none; fill:#00ff00;
    fill-opacity: 0.5;&quot; /&amp;gt;   
&amp;lt;/svg&amp;gt;&lt;/pre&gt;
While it is possible to use JavaScript to dynamically modify an SVG graphic, HTML 5 provides a better solution:&lt;br /&gt;
&lt;h2&gt;
The blank &lt;code&gt;canvas&lt;/code&gt;&lt;/h2&gt;
The &lt;code&gt;canvas&lt;/code&gt; element is one of the most exciting features of HTML 5, and it’s supported by Firefox, Safari, Opera, and Chrome—but not Internet Explorer. (Color me surprised.) The &lt;code&gt;canvas&lt;/code&gt; element is truly a forward-looking feature. You use JavaScript to draw whatever you need on this (literally) blank canvas.&lt;br /&gt;
Here’s the same graphic as the SVG graphic, only on a canvas:&lt;br /&gt;
&lt;div class=&quot;working-sample&quot;&gt;
&lt;a href=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAIAAABM5OhcAAAENUlEQVR4nO3dz4tVZRzH8fck4kwlLmKEQklCIsskCEEMmQEDXZiCITgYSUMUiNpmxGS8PN9/IVpOYOS2jbjQQgQdXSi1cSlouBk3dgkC7Qc2LSaHqbx37rnneZ5zvvd83jzbu/nOi3PPuXPv84BSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZ7SMIzDFMzANbgDc9CGNszBHZiFGZiCMVi1+DJztLZgLSzAfLn1HYyUnvegNwrH4DI8KjLah3AJjsKIVc6loKoIsGSrazvgHPxRbsCtwMHAeqvcTc+q4sCSrac1DlciTTfYP+twfXn9W1U0WLK1pFfgfLy5LoW1sCYCa6xySV1VxYQlWwB8AL9GHer/YQXjVOANq9xTZ1WRYTXb1jB8FXucnWAtrD3GilBLVfFhNdXWKNxMo6oLrGB8HCp8ZuysKgms5tl6EW4lU9UdVjA+NZ6v4LrVVVUqWE2ytRZup1S1LKxgHAmMZLW1nKqEsJphaxiuJlbVC6yFTyJy3W/1oCotrHn4fsBtfZ1eVY+wgvFeDli9qUoOa6BtfZhFVe+wgvGm1UNVDlgDausl+KV+sE6GdDfyRVRlgjWItr7NNblCsILxviVQFd4qpiofrMGytTPj2IrCCsbLIa6qt4uRyg1rUGwNwY/1hjVpVavKDWsgbO3KPrOisIKxwSpVVQEs/7YueIA1YVGuWAXvqyqGNQ+TGSFEbR089gCrFef/PP2qqgzWJ1k1ROxEFdPqA1YwtgmWo2b9wDosWF5aDX/6gTVtrCxrS7CylP95sAysGM+GgpWl095gvWOC5aGz3mDtM8Hy0A1vsEp/BC9YWbrnDdZxEywP/ewN1okgWB763RusaRMsDwmWYCXpgTdYeiv00U/eYB0XLBdd9wbrI8Fy0RlvsPYKlos+9wZruwmWh971BmuDCZaHnoXf/MCajvCje8HKlb7oJ1hJ+swPrK2C5ai1pbdAzgNr2qJsbCRYGWvSz78mXMFqw+aMEGI35gHWuhADVngGO+AE1n3YlJNBkjJstlYGVozb9kVbQ9j+2sO6D6/l+/Onq2GbgvRlS6r665u6wtprUVVZv7akqr8at/FaUVtS1Xd74K+awdpoaVRZcVtSVaYv6wRrV0ipygrakqoyNXE77h5tSVXJVsMPVcOajLBNQ2xbUlW+Jh55sqytJJOYa5CqhZ6Di1XAOhTyXquWru62pCpWTTxWrostqYpb4w7C7GRLqqL3AnwRdavSpaRaxu7cZ331ZUuqEjXeqMPGwxBhfwJYUtWhHXCu9HcDW4GDtSW1uP5jS6oyNArH4DI8KjLXh3AJjlLh4bwlbElVzoZhHKZgBq7BXWg/GWQb7sIszMAUjMGqxZeZnxVWEDZhr8OBcuvV0sNWSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppRTwN4694znCe3ZHAAAAAElFTkSuQmCC&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAIAAABM5OhcAAAENUlEQVR4nO3dz4tVZRzH8fck4kwlLmKEQklCIsskCEEMmQEDXZiCITgYSUMUiNpmxGS8PN9/IVpOYOS2jbjQQgQdXSi1cSlouBk3dgkC7Qc2LSaHqbx37rnneZ5zvvd83jzbu/nOi3PPuXPv84BSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZ7SMIzDFMzANbgDc9CGNszBHZiFGZiCMVi1+DJztLZgLSzAfLn1HYyUnvegNwrH4DI8KjLah3AJjsKIVc6loKoIsGSrazvgHPxRbsCtwMHAeqvcTc+q4sCSrac1DlciTTfYP+twfXn9W1U0WLK1pFfgfLy5LoW1sCYCa6xySV1VxYQlWwB8AL9GHer/YQXjVOANq9xTZ1WRYTXb1jB8FXucnWAtrD3GilBLVfFhNdXWKNxMo6oLrGB8HCp8ZuysKgms5tl6EW4lU9UdVjA+NZ6v4LrVVVUqWE2ytRZup1S1LKxgHAmMZLW1nKqEsJphaxiuJlbVC6yFTyJy3W/1oCotrHn4fsBtfZ1eVY+wgvFeDli9qUoOa6BtfZhFVe+wgvGm1UNVDlgDausl+KV+sE6GdDfyRVRlgjWItr7NNblCsILxviVQFd4qpiofrMGytTPj2IrCCsbLIa6qt4uRyg1rUGwNwY/1hjVpVavKDWsgbO3KPrOisIKxwSpVVQEs/7YueIA1YVGuWAXvqyqGNQ+TGSFEbR089gCrFef/PP2qqgzWJ1k1ROxEFdPqA1YwtgmWo2b9wDosWF5aDX/6gTVtrCxrS7CylP95sAysGM+GgpWl095gvWOC5aGz3mDtM8Hy0A1vsEp/BC9YWbrnDdZxEywP/ewN1okgWB763RusaRMsDwmWYCXpgTdYeiv00U/eYB0XLBdd9wbrI8Fy0RlvsPYKlos+9wZruwmWh971BmuDCZaHnoXf/MCajvCje8HKlb7oJ1hJ+swPrK2C5ai1pbdAzgNr2qJsbCRYGWvSz78mXMFqw+aMEGI35gHWuhADVngGO+AE1n3YlJNBkjJstlYGVozb9kVbQ9j+2sO6D6/l+/Onq2GbgvRlS6r665u6wtprUVVZv7akqr8at/FaUVtS1Xd74K+awdpoaVRZcVtSVaYv6wRrV0ipygrakqoyNXE77h5tSVXJVsMPVcOajLBNQ2xbUlW+Jh55sqytJJOYa5CqhZ6Di1XAOhTyXquWru62pCpWTTxWrostqYpb4w7C7GRLqqL3AnwRdavSpaRaxu7cZ331ZUuqEjXeqMPGwxBhfwJYUtWhHXCu9HcDW4GDtSW1uP5jS6oyNArH4DI8KjLXh3AJjlLh4bwlbElVzoZhHKZgBq7BXWg/GWQb7sIszMAUjMGqxZeZnxVWEDZhr8OBcuvV0sNWSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppRTwN4694znCe3ZHAAAAAElFTkSuQmCC&quot; /&gt;&lt;/a&gt;&lt;canvas height=&quot;100&quot; id=&quot;simpleCanvas&quot; style=&quot;border: 1px solid black;&quot; width=&quot;200&quot;&gt;
&lt;/canvas&gt;&lt;br /&gt;
Sorry, but your browser does not support
&lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; :(&lt;br /&gt;


&lt;/div&gt;
And here’s the JavaScript that created it (with multiple statements per line to save space):&lt;br /&gt;
&lt;pre&gt;function drawSimpleCanvas() {
  var canvas =
    document.getElementById(&quot;simpleCanvas&quot;);
  if (canvas.getContext) {
    var ctx = canvas.getContext(&quot;2d&quot;);
    
    ctx.beginPath(); // the circle
    ctx.fillStyle = &quot;#ff0000&quot;;
    ctx.arc(50, 50, 30, 0, 2*Math.PI, true);
    ctx.closePath();
    ctx.fill();
    ctx.save();
        
    // move and resize the octagon
    ctx.translate(100, 20);
    ctx.scale(1.65, 1.65);
    ctx.fillStyle = &quot;#0000ff&quot;;
    ctx.beginPath();
    ctx.moveTo(36, 25); ctx.lineTo(25, 36);
    ctx.lineTo(11, 36); ctx.lineTo(0, 25);
    ctx.lineTo(0, 11); ctx.lineTo(11, 0);
    ctx.lineTo(25, 0); ctx.lineTo(36, 11);
    ctx.closePath();
    ctx.fill();
        
    // restore graphics as they
    // were before move and resize
    ctx.restore();
    ctx.fillStyle = &quot;#00ff00&quot;;
    ctx.globalAlpha = 0.5;
    ctx.beginPath();
    ctx.rect(60, 20, 60, 60);
    ctx.closePath();
    ctx.fill();
  }
}&lt;/pre&gt;
Here is a &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; that demonstrates simple user interaction:&lt;br /&gt;
&lt;div class=&quot;working-sample&quot;&gt;
&lt;canvas height=&quot;135&quot; id=&quot;shapeCanvas&quot; style=&quot;border: 1px solid black;&quot; width=&quot;270&quot;&gt;
&lt;/canvas&gt;&lt;br /&gt;
Sorry, but your browser does not support
&lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; :( &lt;br /&gt;



&lt;br /&gt;
&lt;form action=&quot;javascript:drawShape();&quot; id=&quot;drawingForm&quot;&gt;
&lt;br /&gt;
Draw:
     &lt;select id=&quot;shapeType&quot; name=&quot;shapeType&quot; onchange=&quot;changeMax();&quot;&gt;
        &lt;option value=&quot;0&quot;&gt;Circle with radius&lt;/option&gt;
        &lt;option value=&quot;1&quot;&gt;Square with side&lt;/option&gt;
        &lt;option value=&quot;2&quot;&gt;Diamond with side&lt;/option&gt;
    &lt;/select&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;input id=&quot;shapeSize&quot; max=&quot;60&quot; min=&quot;10&quot; name=&quot;shapeSize&quot; required=&quot;required&quot; size=&quot;3&quot; type=&quot;number&quot; /&gt; pixels,
    color #&lt;input id=&quot;shapeColor&quot; name=&quot;shapeColor&quot; pattern=&quot;[0-9A-Fa-f]{3}([0-9A-Fa-f]{3})?&quot; required=&quot;required&quot; size=&quot;8&quot; title=&quot;3 or 6 hex digits&quot; type=&quot;text&quot; /&gt;&lt;br /&gt;
&lt;input type=&quot;submit&quot; value=&quot;Draw&quot; /&gt;&lt;/form&gt;
&lt;/div&gt;
Normally, you will use a canvas to display graphics that support your content. For example, saying “the mean of a set of numbers is the ‘center of gravity’ of that set” is fine, but using a &lt;code&gt;canvas&lt;/code&gt; element with associated JavaScript to let the reader enter a set of numbers and &lt;i&gt;show&lt;/i&gt; her that the mean is the “balance point” is much more effective.&lt;br /&gt;
&lt;div class=&quot;working-sample&quot;&gt;
&lt;form action=&quot;javascript:void(0)&quot; id=&quot;itemForm&quot; onsubmit=&quot;return false();&quot;&gt;
Enter numbers, separated by commas or blanks:&lt;br /&gt;
&lt;input id=&quot;itemData&quot; onchange=&quot;showData(); return false&quot; type=&quot;text&quot; value=&quot;3,5,5,7,9,10&quot; /&gt;
    &lt;input onclick=&quot;showData(); return false;&quot; type=&quot;button&quot; value=&quot;Display Data&quot; /&gt;
&lt;/form&gt;
&lt;/div&gt;
These examples don’t even begin to show the scope of the &lt;code&gt;canvas&lt;/code&gt; element’s capabilities. See Mozilla’s &lt;a href=&quot;https://developer.mozilla.org/en/Canvas_tutorial&quot;&gt;Canvas tutorial&lt;/a&gt; for a more thorough introduction as well as links to examples.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;script type=&quot;text/javascript&quot;&gt;
var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;);
document.write(unescape(&quot;%3Cscript src=&#39;&quot; + gaJsHost + &quot;google-analytics.com/ga.js&#39; type=&#39;text/javascript&#39;%3E%3C/script%3E&quot;));
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
try {
var pageTracker = _gat._getTracker(&quot;UA-11757054-1&quot;);
pageTracker._trackPageview();
} catch(err) {}
&lt;/script&gt;



&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/3420166941316852245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/3420166941316852245' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/3420166941316852245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/3420166941316852245'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/get-ready-for-html-5.html' title='Get Ready for HTML 5'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-3056773288147845661</id><published>2012-01-01T23:59:00.001-08:00</published><updated>2012-02-14T02:04:20.058-08:00</updated><title type='text'>The CSS3 Selectors module and CSS3 Namespaces module</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The CSS3 Selectors module and CSS3 Namespaces module have both been 
released as official W3C recommendations, becoming the second and third 
CSS3 modules, respectively, to reach the end of the development cycle, 
following on from the release of the CSS3 Color module as a W3C 
recommendation earlier this year.&lt;br /&gt;
&lt;span id=&quot;more-1733&quot;&gt;&lt;/span&gt;&lt;br /&gt;
According to a post on the CSS Working Group’s blog:&lt;br /&gt;
&lt;blockquote&gt;
Today W3C issued two new Recommendations: Selectors Level
 3 and it dependency, CSS Namespaces. Selectors Level 3 has been a core 
part of CSS for awhile now, and is interoperably implemented by all 
modern browsers (including IE as of IE9). CSS Namespaces, which allows 
namespace-specific selectors, just completed its PR review phase, 
allowing both it and Selectors Level 3 to progress to W3C 
Recommendation.&lt;/blockquote&gt;
The finalized specifications can be found here:&lt;br /&gt;
&lt;a href=&quot;http://www.w3.org/TR/2011/REC-css3-selectors-20110929/&quot; target=&quot;_blank&quot;&gt;Selectors Level 3 – W3C Recommendation&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.w3.org/TR/2011/REC-css3-namespace-20110929/&quot; target=&quot;_blank&quot;&gt;CSS Namespaces – W3C Recommendation&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/3056773288147845661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/3056773288147845661' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/3056773288147845661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/3056773288147845661'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/css3-selectors-module-and-css3.html' title='The CSS3 Selectors module and CSS3 Namespaces module'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-7034246055999329257</id><published>2012-01-01T23:58:00.000-08:00</published><updated>2012-01-01T23:58:15.458-08:00</updated><title type='text'>Radial gradients</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I raised the issue that the radial gradients we were discussing were 
unreadable to me, and probably therefore to much of the intended 
audience. It was not at all obvious by looking at the gradient syntax 
what the various numbers and lengths might be.
&lt;br /&gt;
&lt;pre&gt;radial-gradient(60% 43%, 25px 25px, #b03 99%, transparent)&lt;/pre&gt;
So Tab Atkins, David Baron, Brad Kemper, Brian Manthos and I hashed out an alternative syntax.&lt;br /&gt;

&lt;pre&gt;radial-gradient(circle to 25px at 60% 43%, #b03 99%, transparent)&lt;/pre&gt;
&lt;strong&gt;We’d like your opinion on which is preferred and why.&lt;/strong&gt;&lt;br /&gt;
&lt;span id=&quot;more-1742&quot;&gt;&lt;/span&gt;&lt;br /&gt;

&lt;table cellpadding=&quot;5&quot; class=&quot;data&quot; rules=&quot;groups&quot;&gt;
&lt;caption&gt;Examples&lt;/caption&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;a href=&quot;http://www.w3.org/TR/2011/WD-css3-images-20110908/#repeating-gradients&quot;&gt;Current WD&lt;/a&gt;
&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;http://dev.w3.org/cvsweb/%7Echeckout%7E/csswg/css3-images/Overview.html?rev=1.200;content-type=text%2Fhtml&quot;&gt;Current ED&lt;/a&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(white, black)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(white, black)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(farthest-corner ellipse, center, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(ellipse to farthest-corner at center, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(top left, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(at top left, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(top left, farthest-corner ellipse, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(ellipse at top left to farthest-corner, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(circle, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(circle, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(circle, center, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(circle at center, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(center, 5em 5em, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(to 5em, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(center, 5em 5em, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(circle to 5em at center, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(75% 75%, closest-side circle, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(circle at 75% 75% to closest-side, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(25% 2em, 15px 30%, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(ellipse to 15px 30% at 25% 2em, white, black)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
The generic forms are (very roughly speaking):&lt;br /&gt;

&lt;table cellpadding=&quot;5&quot; class=&quot;data&quot; rules=&quot;groups&quot;&gt;
&lt;caption&gt;General Syntax&lt;/caption&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;a href=&quot;http://www.w3.org/TR/2011/WD-css3-images-20110908/#repeating-gradients&quot;&gt;Current WD&lt;/a&gt;
&lt;/th&gt;
&lt;th&gt;&lt;a href=&quot;http://dev.w3.org/cvsweb/%7Echeckout%7E/csswg/css3-images/Overview.html?rev=1.200;content-type=text%2Fhtml&quot;&gt;Current ED&lt;/a&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(position, [size || shape], color-stops)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;radial-gradient(shape [to size || at position], color-stops)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
Shape/size and position are optional, unless the shape/size is given 
with explicit lengths, in which case the position must also be specified
&lt;/td&gt;
&lt;td&gt;
Each of shape, size, and position are optional. The size and shape clauses can be reordered.
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
As a side effect, the keyword-based syntax more easily allows us to add other capabilities in the future. For example, &lt;a href=&quot;http://msmvps.com/cfs-filesystemfile.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/deborahk.metablogapi/1488.image_5F00_thumb_5F00_591CAA98.png&quot;&gt;offset radials&lt;/a&gt; could be expressed using a &lt;code&gt;from position&lt;/code&gt; clause for the color origin.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/7034246055999329257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/7034246055999329257' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7034246055999329257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7034246055999329257'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/radial-gradients.html' title='Radial gradients'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-2989287710083244039</id><published>2012-01-01T23:55:00.001-08:00</published><updated>2012-01-01T23:55:49.433-08:00</updated><title type='text'>Imagine a multi-column element</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
We’ve got a bit of a tricky question on expected behavior of multi-column layout for you folks.&lt;br /&gt;

First, I want you to imagine a multi-column element. Like this one:&lt;br /&gt;

&lt;img alt=&quot;In a multi-column element, several paragraphs of text flow into three height-balanced columns.&quot; src=&quot;http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0080/multicol.png&quot; style=&quot;margin: 1em auto;&quot; /&gt;&lt;br /&gt;

Now suppose that you want to use a column-spanning element. 
Column-spanning elements stretch across the entire multi-column element.
 Content before one balances into a short row of columns before it, and 
content after it continues in another row of columns after it. Like 
this:&lt;br /&gt;

&lt;img alt=&quot;In a three-column multi-column element, a column-spanning header spans across all three columns.&quot; src=&quot;http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0080/multicol-spanner.png&quot; style=&quot;margin: 1em auto;&quot; /&gt;&lt;br /&gt;

Next, suppose you place two spanning elements, one after the other, like this:&lt;br /&gt;

&lt;img alt=&quot;In a three-column multi-column element, both a column-spanning header and a column-spanning image immediately after it span across all three columns.&quot; src=&quot;http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0080/multicol-2spanner.png&quot; style=&quot;margin: 1em auto;&quot; /&gt;&lt;br /&gt;

Finally, &lt;strong&gt;suppose you gave each spanner a 1em vertical margin on both sides (&lt;code&gt;margin: 1em 0&lt;/code&gt;)&lt;/strong&gt;.
 Remember that vertical margins between normal block-level elements 
collapse (so there would be only 1em gap between the two) whereas 
margins between stacked floating elements do not collapse (so there 
would be a 2em gap between the two).&lt;br /&gt;

&lt;strong&gt;In your ideal world, is there a 1em or 2em gap between the two elements?&lt;/strong&gt;&lt;br /&gt;

&lt;table style=&quot;margin: 1em auto; text-align: center;&quot;&gt;
&lt;colgroup&gt;&lt;col span=&quot;2&quot; width=&quot;50%&quot;&gt;&lt;/col&gt;
&lt;/colgroup&gt;&lt;tfoot&gt;
&lt;tr&gt;
&lt;th&gt;Separate Margins (2em Gap) &lt;/th&gt;
&lt;th&gt;Collapsed Margins (1em Gap)&lt;/th&gt;
&lt;/tr&gt;
&lt;/tfoot&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img alt=&quot;&quot; src=&quot;http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0080/multicol-2spanner-separate.png&quot; style=&quot;width: 100%;&quot; /&gt; &lt;/td&gt;
&lt;td&gt;&lt;img alt=&quot;&quot; src=&quot;http://lists.w3.org/Archives/Public/www-archive/2011Nov/att-0080/multicol-2spanner-collapse.png&quot; style=&quot;width: 100%;&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;

&lt;/table&gt;
Post your thoughts in the comment section, and we’ll forward them to the CSS Working Group.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/2989287710083244039/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/2989287710083244039' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/2989287710083244039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/2989287710083244039'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/imagine-multi-column-element.html' title='Imagine a multi-column element'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-7888941962049030742</id><published>2012-01-01T23:54:00.000-08:00</published><updated>2012-01-01T23:54:11.632-08:00</updated><title type='text'>Changes to Gradients  Below is a summary of the major changes to CSS gradients over the past year:</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Below is a summary of the major changes to CSS gradients over the past year:&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;Angles in &lt;code&gt;linear-gradient()&lt;/code&gt; changed from polar angles 
to bearing angles (compass directions). 0° now points up 
(bottom-to-top), and angles increase clockwise. See &lt;a href=&quot;http://www.css3.info/angles-in-gradients/&quot;&gt;Angles in Gradients&lt;/a&gt; for the feedback that informed this decision.&lt;/li&gt;
&lt;li&gt;Keyword directions in &lt;code&gt;linear-gradient()&lt;/code&gt; changed from bare directional keywords (&lt;code&gt;top&lt;/code&gt;, &lt;code&gt;right&lt;/code&gt;, &lt;code&gt;bottom&lt;/code&gt;, &lt;code&gt;left&lt;/code&gt;) indicating the starting point to &lt;code&gt;to ‹keyword›&lt;/code&gt; where the keyword indicates the endpoint. (&lt;code&gt;to bottom&lt;/code&gt;, &lt;code&gt;to left&lt;/code&gt;, &lt;code&gt;to bottom&lt;/code&gt;, &lt;code&gt;to left&lt;/code&gt;). This change was made because Tab felt having &lt;code&gt;0deg&lt;/code&gt; mean bottom-to-top made the fact that &lt;code&gt;top&lt;/code&gt; meant top-to-bottom confusing. The WG was split but mostly ambivalent on whether this was necessary, or whether &lt;code&gt;from ‹keyword›&lt;/code&gt; was a better alternative; the resolution landed on &lt;code&gt;to ‹keyword›&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Corner-to-corner &lt;code&gt;linear-gradient()&lt;/code&gt; has been redefined 
so that instead of aligning the gradient line to the diagonal, the 
central color occupies the other diagonal. See &lt;a href=&quot;http://lists.w3.org/Archives/Public/www-style/2011Jul/0265.html&quot;&gt;Behnam Esfabad’s post&lt;/a&gt; for a demonstration showing the old and new (“magic”) versions.&lt;/li&gt;
&lt;li&gt;Syntax of &lt;code&gt;radial-gradient()&lt;/code&gt; has been changed to (roughly) &lt;a href=&quot;http://www.w3.org/TR/2011/WD-css3-images-20111206/#radial-gradients&quot;&gt;&lt;code&gt;radial-gradient( [ ‹size› || ‹shape› ] [ at ‹position› ]?, ‹color-stop-list› )&lt;/code&gt;&lt;/a&gt;:
 specifically, the shape/size and position parameters are collapsed into
 the first argument using CSS property value conventions, allowing 
either or both to be specified. Position is distinguished from size by 
the preceding &lt;code&gt;at&lt;/code&gt; keyword. See &lt;a href=&quot;http://www.css3.info/radial-gradient-readability/&quot;&gt;Radial Gradient Readability&lt;/a&gt; for some of the thinking that went into this change.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Other Features&lt;/h3&gt;
Although CSS gradients are undoubtedly the most anticipated feature in &lt;a href=&quot;http://www.w3.org/TR/css3-images/&quot;&gt;CSS3 Images&lt;/a&gt;, there are a number of other features in this draft:&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.w3.org/TR/media-frags/&quot;&gt;Media Fragments&lt;/a&gt; can be used to &lt;a href=&quot;http://www.w3.org/TR/media-frags/#naming-space&quot;&gt;clip out&lt;/a&gt; part of an image and use it in CSS. The new  &lt;a href=&quot;http://www.w3.org/TR/css3-images/#image-notation&quot;&gt;&lt;code&gt;image()&lt;/code&gt; notation&lt;/a&gt;, which can be used in place of &lt;code&gt;url()&lt;/code&gt;, allows authors to trigger CSS parser fallback in older UAs when using media fragments.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;http://www.w3.org/TR/css3-images/#image-notation&quot;&gt;&lt;code&gt;image()&lt;/code&gt; notation&lt;/a&gt;
 allows specifying a list of fallback images in various formats and 
allows annotating images with left-to-right or right-to-left 
directionality so that they flip automatically to match the element’s 
directionality.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;http://www.w3.org/TR/css3-images/#object-fit&quot;&gt;&lt;code&gt;object-fit&lt;/code&gt;&lt;/a&gt; property allows preserving the aspect ratio of an image when assigning its box a specified size. In conjunction with the &lt;code&gt;min/max-width/height&lt;/code&gt; properties, it also allows scaling the image and its box up to a given maximum, or down to a given minimum. The &lt;a href=&quot;http://www.w3.org/TR/css3-images/#object-position&quot;&gt;&lt;code&gt;object-position&lt;/code&gt;&lt;/a&gt; property allows repositioning the image within its content box using background-positioning sytax when &lt;code&gt;object-fit&lt;/code&gt; causes the aspect ratio of the image and the content box to mismatch.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;http://www.w3.org/TR/css3-images/#image-resolution&quot;&gt;&lt;code&gt;image-resolution&lt;/code&gt;&lt;/a&gt; property allows for using bitmap resolutions other than 1 image pixel == 1 CSS px unit.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/7888941962049030742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/7888941962049030742' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7888941962049030742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/7888941962049030742'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/changes-to-gradients-below-is-summary.html' title='Changes to Gradients  Below is a summary of the major changes to CSS gradients over the past year:'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-8489506524811637400</id><published>2012-01-01T23:50:00.001-08:00</published><updated>2012-01-01T23:50:31.227-08:00</updated><title type='text'>Tools &amp; resources for web professionals</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
http://westciv.com/&lt;br /&gt;
&lt;br /&gt;
Tools &amp;amp; resources for web professionals&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/8489506524811637400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/8489506524811637400' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/8489506524811637400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/8489506524811637400'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/tools-resources-for-web-professionals.html' title='Tools &amp; resources for web professionals'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-9134631972726674174</id><published>2012-01-01T23:40:00.000-08:00</published><updated>2012-01-01T23:40:44.357-08:00</updated><title type='text'>5 Exciting Things to Look Forward to in HTML 5</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
HTML 5 is the upcoming major revision of the 
HyperText Markup Language (HTML), the main method of marking up content 
for sharing on the World Wide Web. HTML&#39;s development stopped at HTML 
4.01 in 1999, and since then web content has evolved so much that 
current HTML specifications are inadequate for today&#39;s requirements.
&lt;br /&gt;
&lt;span style=&quot;float: right; margin-left: 10px;&quot;&gt;&lt;span class=&quot;db-wrapper db-clear db-large&quot;&gt;&lt;span&gt;&lt;span class=&quot;db-container db-submit&quot;&gt;&lt;span class=&quot;db-body db-large&quot;&gt;&lt;span class=&quot;db-count&quot;&gt;0&lt;/span&gt;&lt;a class=&quot;db-anchor&quot; href=&quot;&quot;&gt;digg&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;HTML
 5 aims to improve HTML&#39;s interoperability and address the growing 
demand for more diverse and complex web content. It also addresses HTML 
4&#39;s lacking features for web applications. In this post, we&#39;ll look at &lt;strong&gt;5 exciting new features in HTML 5&lt;/strong&gt;.&lt;br /&gt;






&lt;div id=&quot;predicta&quot;&gt;
&lt;a href=&quot;http://d.ads.readwriteweb.com/ck.php?oaparams=2__bannerid=185629__zoneid=79436__cb=491666fee6__r_id=a6cd2c6588deb92ed8b8163a7ef540b2__r_ts=lx5tym__oadest=http%3A%2F%2Fwww.gagein.com%2F%3Futm_source%3DRWW%26utm_medium%3DBanner%252Blogo%26utm_content%3D125x125%252Blogo%26utm_campaign%3DRWW%252Bbanner%252Blogo&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;h2&gt;
A bit of history&lt;/h2&gt;
The conceptual thinking for HTML 5 began in late 2003. The &lt;a href=&quot;http://www.w3.org/&quot;&gt;World Wide Web Consortium&lt;/a&gt;
 (W3C), the organization that oversees the web&#39;s standard protocols and 
guidelines, expressed interest in the HTML 5 draft originally developed 
by the &lt;a href=&quot;http://www.whatwg.org/&quot;&gt;Web Hypertext Application Technology Working Group&lt;/a&gt;
 (WHATWG), a group formed in 2004 consisting of representatives of 
Apple, the Mozilla Foundation, and Opera Software. As a result, the &lt;a href=&quot;http://www.w3.org/html/wg/&quot;&gt;W3C HTML Working Group&lt;/a&gt; was formed in 2007 to develop the specifications of HTML 5.&lt;br /&gt;


Development is underway, and HTML 5 is anticipated to reach W3C 
Candidate Recommendation status in 2012, though many modern browsers 
already have partial support for HTML 5 specifications.&lt;br /&gt;


&lt;h2&gt;
Exciting new features&lt;/h2&gt;
&lt;strong&gt;1. New HTML elements that improve our ability to describe content&lt;/strong&gt;&lt;br /&gt;


HTML&#39;s primary task is to &lt;strong&gt;describe&lt;/strong&gt; the structure of a web page. For example, by enclosing text between &lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;/code&gt; elements, HTML tells the browser that the text between those elements is a &lt;strong&gt;paragraph&lt;/strong&gt;.&lt;br /&gt;


&lt;img height=&quot;141&quot; src=&quot;http://rww.readwriteweb.netdna-cdn.com/images/html5_dec08b.jpg&quot; width=&quot;531&quot; /&gt;&lt;br /&gt;


Increasingly, diverse web content has outgrown HTML 4&#39;s ability to 
accurately describe the content of a web page. Streaming video and audio
 is now commonplace. Website regions such as navigation menus and 
branding areas (commonly located in the header) are now staples of most 
web pages. More importantly, advancements in JavaScript, Flash, and 
server-side technologies have allowed for the proliferation of &lt;a href=&quot;http://en.wikipedia.org/wiki/Rich_Internet_application&quot;&gt;rich Internet applications&lt;/a&gt; (responsive, user-driven, browser-based applications), despite current HTML specifications.&lt;br /&gt;


By adding more &lt;a href=&quot;http://www.ibm.com/developerworks/library/x-html5/&quot; title=&quot;New elements in HTML 5 - IBM developerWorks.&quot;&gt;HTML elements&lt;/a&gt;, HTML 5 aims to give developers a better and more precise way of describing data.&lt;br /&gt;


For example, under current HTML specifications, this is how we would describe the structure of a typical web page:&lt;br /&gt;


&lt;img height=&quot;380&quot; src=&quot;http://rww.readwriteweb.netdna-cdn.com/images/html5_dec08c.jpg&quot; width=&quot;531&quot; /&gt;&lt;br /&gt;


The problem with this layout is that, &lt;strong&gt;to the browser&lt;/strong&gt;, everything is a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; element. The browser treats everything inside the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; elements &lt;strong&gt;equally&lt;/strong&gt; because it can&#39;t tell the difference between them, and &quot;classes&quot; and &quot;ids,&quot; such as &lt;code&gt;content&lt;/code&gt;, &lt;code&gt;sidebar&lt;/code&gt;, and &lt;code&gt;footer&lt;/code&gt;, change from website to website.&lt;br /&gt;


In HTML 5, this is how you might describe the layout of the same web page:&lt;br /&gt;


&lt;img height=&quot;385&quot; src=&quot;http://rww.readwriteweb.netdna-cdn.com/images/html5_dec08d.jpg&quot; width=&quot;534&quot; /&gt;&lt;br /&gt;


In this markup, the browser now knows what each part is. It knows that the web page&#39;s main content is inside the &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; element, that the website&#39;s navigation is inside the &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; element, and so on.&lt;br /&gt;


Besides prettier-looking and more semantic markup, the practical implications are endless. It increases our markup&#39;s &lt;strong&gt;interoperability&lt;/strong&gt;.
 For example, an external system, such as a search engine spider, would 
be able to more accurately determine what content on a web page is 
important. It can skip crawling the &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; element and the &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt;
 element because they probably do not contain the main content of the 
web page. A well-formed HTML 5 document would therefore give search 
engines a better understanding of the content being displayed.&lt;br /&gt;


A crafty developer could create an application that pulls out just the &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;
 section of a group of websites, say, to aggregate it in a database, or 
generate a list of all the videos on a web page by finding all the &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/#video&quot;&gt;&lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; elements&lt;/a&gt;.&lt;br /&gt;


Screen-reading software could give vision-impaired users a quicker way to traverse content sections. They could go to the &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; element directly if they wanted to read the main content of the web page, or go directly to the &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; element if they wanted to navigate away from the page.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;2. Improved web forms handling&lt;/strong&gt;&lt;br /&gt;


These days, it&#39;s hard not to come across forms on websites. You 
encounter them when submitting a comment on a blog, registering for a 
user account, or sendinging mail in Gmail. HTML 5&#39;s proposed 
specifications include a huge revamping, called &lt;a href=&quot;http://www.whatwg.org/specs/web-forms/current-work/&quot;&gt;Web Forms 2.0&lt;/a&gt;,
 of how web forms would be handled. It gives web developers a lot of 
options and new features for effectively and easily handling input 
fields and form submissions.&lt;br /&gt;


The most exciting thing about Web Forms 2.0 is &lt;strong&gt;form validation&lt;/strong&gt;.
 Currently, developers are required to use JavaScript (client-side) or 
PHP (server-side) code to validate inputs. For example, many web forms 
contain required fields (perhaps for the username and email fields):&lt;br /&gt;


&lt;img height=&quot;203&quot; src=&quot;http://rww.readwriteweb.netdna-cdn.com/images/html5_dec08e.jpg&quot; width=&quot;261&quot; /&gt;&lt;br /&gt;


In HTML 4, the markup of the web form above would look something like:&lt;br /&gt;


&lt;img height=&quot;175&quot; src=&quot;http://rww.readwriteweb.netdna-cdn.com/images/html5_dec08f.jpg&quot; width=&quot;511&quot; /&gt;&lt;br /&gt;


Currently, you have to use scripting to validate a user&#39;s submission.
 In this example, developers would have to write their own validation 
code (or use a pre-made script, &lt;a href=&quot;http://javascript-form-validation.googlecode.com/svn/trunk/validation.js&quot;&gt;such as this one&lt;/a&gt;)
 to ensure that required fields aren&#39;t left blank by accident or that 
submitted email addresses are valid (usually by doing something called 
&quot;regular expression&quot; matching).&lt;br /&gt;


In handling this form without requiring the author to include a 
validation script, HTML 5 (with the current Web 2.0 specifications) 
would give us additional element attributes, such as &lt;code&gt;&lt;a href=&quot;http://www.whatwg.org/specs/web-forms/current-work/#required0&quot;&gt;required&lt;/a&gt;&lt;/code&gt; and &lt;code&gt;&lt;a href=&quot;http://www.whatwg.org/specs/web-forms/current-work/#email&quot;&gt;email&lt;/a&gt;&lt;/code&gt;
 attributes, which automatically check that the username and email 
fields are not left blank and that the email address&#39; format is valid.&lt;br /&gt;


&lt;img height=&quot;175&quot; src=&quot;http://rww.readwriteweb.netdna-cdn.com/images/html5_dec08g.jpg&quot; width=&quot;511&quot; /&gt;&lt;br /&gt;


&lt;strong&gt;3. APIs for easier web application development&lt;/strong&gt;&lt;br /&gt;


HTML 5 will introduce several &lt;a href=&quot;http://en.wikipedia.org/wiki/API&quot;&gt;application programming interfaces&lt;/a&gt;
 (APIs) to new and existing elements, aimed at improving web application
 development and addressing current issues with HTML 4&#39;s lack of ability
 to allow developers to mark up web applications.&lt;br /&gt;


One API is specifically for working with audio and video and will be used with the &lt;code&gt;&amp;lt;audio&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt;
 elements. It will provide audio and video playback capabilities and 
eliminate the need to use third-party applications, such as Flash, to 
develop and display media (at least for supported media files).&lt;br /&gt;


&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img height=&quot;84&quot; src=&quot;http://rww.readwriteweb.netdna-cdn.com/images/html5_dec08h.jpg&quot; width=&quot;533&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;4. The &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element allows image scripting on the fly&lt;/strong&gt;&lt;br /&gt;


Most people take in information more quickly and effectively through 
visuals. For example, between a table, numerical data, and a pie chart, 
the pie chart gives users a better feel for the scale and relationship 
of data (at least most of the time).&lt;br /&gt;


&lt;img height=&quot;233&quot; src=&quot;http://rww.readwriteweb.netdna-cdn.com/images/html5_dec08i.jpg&quot; width=&quot;511&quot; /&gt;&lt;br /&gt;


The downside of images is that they&#39;re &lt;strong&gt;static&lt;/strong&gt;. If 
you create a pie chart using a traditional method (for example, with an 
image editor like Photoshop, or a graphing application like Excel), you 
wouldn&#39;t be able to adjust any data that changes without manually 
editing your graphics.&lt;br /&gt;


With the &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/#canvas&quot;&gt;&lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt;&lt;/a&gt;
 element, you can take constantly changing (database-driven) data and 
apply it to a pie chart like the one above, as well as other types of 2D
 visuals (even a cat, if you&#39;re so inclined), via scripting.&lt;br /&gt;


The canvas API also allows users to interact with &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; elements. For example, you can write a script that responds to users&#39; clicking on a particular section of the pie chart.&lt;br /&gt;


&lt;strong&gt;5. Users can edit and interact with sections of a web page&lt;/strong&gt;&lt;br /&gt;


The section in the proposed HTML 5 specifications about &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html&quot;&gt;User Interaction&lt;/a&gt; describes new ways of marking up interactive web pages. The &lt;code&gt;contenteditable&lt;/code&gt; attribute (a boolean attribute to which you assign either &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;) allows you to indicate which parts of a web page users can change.&lt;br /&gt;


This can be useful for wiki-style websites, in which content is user-generated. Another use of the &lt;code&gt;contenteditable&lt;/code&gt;
 attribute would be to create web page templates. You can allow certain 
regions of a web page to be open to content editing and lock other 
regions that shouldn&#39;t be changed. This gives users of your website who 
aren&#39;t proficient in HTML an opportunity to input content safely without
 affecting critical areas that should be handled by more knowledgeable 
users.&lt;br /&gt;


At the document level, you can make an entire page editable via the &lt;code&gt;designMode&lt;/code&gt; attribute, which accepts two values: &lt;code&gt;on&lt;/code&gt; or &lt;code&gt;off&lt;/code&gt;.&lt;br /&gt;


&lt;h2&gt;
In Sum&lt;/h2&gt;
The proposed specifications are slated to reach W3C Candidate Recommendation status in 2012, but that doesn&#39;t mean you have to &lt;a href=&quot;http://wiki.whatwg.org/wiki/FAQ#When_will_we_be_able_to_start_using_these_new_features.3F&quot;&gt;wait that long&lt;/a&gt; to start using some of the new things in HTML 5. A lot of modern browsers, for example, have already implemented the &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; element (including Mozilla Firefox, which has partially implemented it &lt;a href=&quot;https://developer.mozilla.org/en/HTML/Canvas&quot;&gt;since version 1.5&lt;/a&gt;).&lt;br /&gt;


HTML 5 will &lt;strong&gt;redefine&lt;/strong&gt; how web developers mark up 
content. It will provide a better way to describe the content displayed 
on a web page, enable more complex content types, improve media and web 
application support, and increase the interoperability of HTML 
documents.&lt;br /&gt;


Note that things are still under heavy development and are bound to 
change; many of the proposed improvements may be heavily revised in the 
next few years or not implemented at all.&lt;br /&gt;


There are a lot of exciting new features in HTML 5. Share your own favorites in the comments.&lt;br /&gt;


&lt;h2&gt;
Further reading&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;You can read the &lt;a href=&quot;http://www.w3.org/TR/html5/&quot;&gt;latest working draft of HTML 5 specifications&lt;/a&gt; on the W3C website.
&lt;/li&gt;
&lt;li&gt;Learn about the &lt;a href=&quot;http://www.w3.org/TR/html5-diff/&quot;&gt;major differences&lt;/a&gt; between HTML 4 and HTML 5 on the W3C website.&lt;/li&gt;
&lt;li&gt;IBM developerWorks has an excellent in-depth article on &lt;a href=&quot;http://www.ibm.com/developerworks/library/x-html5/&quot;&gt;new elements in HTML 5&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Read about the people in charge of developing HTML 5 specifications on the &lt;a href=&quot;http://www.w3.org/html/wg/&quot;&gt;W3C HTML Working Group website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Find out &lt;a href=&quot;http://wiki.whatwg.org/wiki/What_you_can_do&quot;&gt;what you can do&lt;/a&gt; to help HTML 5 development on the WHATWG wiki website.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/9134631972726674174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/9134631972726674174' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/9134631972726674174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/9134631972726674174'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/5-exciting-things-to-look-forward-to-in.html' title='5 Exciting Things to Look Forward to in HTML 5'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-2819581308791464429</id><published>2012-01-01T23:33:00.000-08:00</published><updated>2012-01-01T23:33:32.902-08:00</updated><title type='text'>Top 10 Tips for E-Commerce Sites</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;1. DON’T FORCE YOUR VISITORS TO THINK &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Ensure your site has intuitive navigation and usable site architecture, not just an appealing look and feel. Visitors should be able to accurately guess what a button or link does before clicking on it.The search function (you do of course have one!) should appear in the navigation bar, preferably at the top right, where users expect to see it — and not as a button but as a type-in field, which saves the visitor from having to go to a search page to do their search. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Upon a keyword search, automatically check spelling and, when appropriate, suggest corrections. If their search is too generic, suggest alternatives (for example,”You just searched for ‘cameras.’ If you’d like, you could try a more specific search like: ‘ canon eos cameras” ‘nikon digital cameras,’ … “).&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;2. LEAVE A TRAIL &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Incorporate “breadcrumb navigation” into your online catalog pages. This will show where in the site hierarchy the currently viewed web page is located and it will give the visitor shortcuts to instantly jump higher up the hierarchy (for example, “Online Catalog &amp;gt; Home Furnishings &amp;gt; Lighting &amp;gt; Table Lamps”). It’s good practice for usability and for search engine optimization.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;3. CUT TO THE CHASE &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Make maximum use of screen real estate to minimise scrolling. Put the most important stuff (like your 0800 number) “above the fold.” Minimize the number of steps required to locate products and make purchases. Amazon.com’s 1-Click ordering is the epitome of efficiency.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;4. BE A LIGHTWEIGHT &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Optimise images for small file sizes and fast downloads, strip out extraneous HTML and remove unnecessary graphics. Ideally, a page should load in less than 10 seconds.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;5. BE OPEN TO ‘OPEN SOURCE’ &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Don’t waste budget on unnecessarily expensive software license when an open-source solution exists. Open source offers a highly customizable, stable and low- or no-cost alternative to proprietary software.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;6. STUDY YOUR CUSTOMER’S EVERY MOVE &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Watch how your customers use your website and learn what frustrates them. Analise your visitor’s traffic patterns (for example, what are the top exit pages, what are the most popular searches that return results), invite customers to complete a survey after they purchase and have informal brainstorming sessions with your most valuable customers.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;b&gt;7. DELIGHT YOUR CUSTOMERS&lt;/b&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Service your customers like your survival depends on it, because it probably does. Reply to email within hours. Keep your commitments to your customers; make “under-promise and over-deliver” your mantra. If your site promises delivery in three days, that doesn’t mean five or 10. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;You’ll also need 24-hour server support to effectively manage traffic surges.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;8. SING TO THE SEARCH ENGINES &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Each product or category page has its own unique “song” and should be made to “sing” for its own set of keywords. Your home page can’t be everything to everybody; it can’t be ranked in the top 10 for every product your online shop carries. The numerous pages that make up your online catalog can serve as a virtual sales force. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;To illustrate, the home page of Netconcept client SmokeCDs.com ranks in the top 10 in Google for “buy CDs” but it’s their category pages that rank well for genres like “drum and bass music,” and product pages that rank well for artists like “Trick Daddy” and albums like “The Matrix Soundtrack.” &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;However, there’s no point in making your pages sing if they aren’t being picked up by the search engine spiders. Some of America’s largest online cataloger have problems getting their full catalogs fully indexed by the major search engines, as detailed in our analyst report The State of Search Engine Cataloging 1.0 (published by Catalog Age). &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;SmokeCDs.com has tens of thousands of product pages in Google, whereas major US music retailer SamGoody.com only has a few hundred. Check how many pages your site has in the major search engines with the free tool at http://web.archive.org/web/20040708075116/. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;The best results are achieved when spider-friendliness and search engine optimisation are built into the site from the ground up rather than added as an afterthought.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;9. FLOG YOUR PRODUCTS &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Merchandising on the web means making clever use of your virtual shelf space. Choose some products to feature on your home page and rotate through them. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Consider having a “Top 10 List” of products (as in the top 10 products you most want to sell). People are like lemmings when it comes to top 10 lists. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Also offer related product recommendations and user-contributed reviews on each of your product pages. Consider promoting limited-time, limited-use special offer codes as a way to stimulate sales.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;b&gt;10. BE FULLY FUNCTIONAL&lt;/b&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;For starters, visitors should be able to add items to a “shopping cart.” Furthermore, they should be able to abandon their carts and and return days later and still have the cart intact. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;They should also be able to create user accounts for ease of repeat ordering and checking order status. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;If it’s a consumer site, they should be able to buy and redeem gift certificates. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Online ordering should of course be secure, with a 128-bit secure server certificate installed. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Finally, hopefully you have an admin interface that allows you to add, remove and update website content yourself. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: Verdana,sans-serif;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Also, regarding the up-and-coming trend for e-commerce sites to offer online forums and the question of how they can add to the site’s value proposition and also serve as search engine fodder, here’s an example of one Netconcepts did.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/2819581308791464429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/2819581308791464429' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/2819581308791464429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/2819581308791464429'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/top-10-tips-for-e-commerce-sites.html' title='Top 10 Tips for E-Commerce Sites'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-230452415134454498</id><published>2012-01-01T23:24:00.001-08:00</published><updated>2012-01-01T23:24:56.902-08:00</updated><title type='text'>Five Technologies That Will Keep Shaping the Web</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
As we’re coming to the end of this year, everyone starts to look 
towards the next one and there will no doubt be an upsurge of articles 
predicting the web trends of 2010 in the next days to come. However, in 
this article, we’ll be talking about what’s actually &lt;strong&gt;driving these trends now&lt;/strong&gt;, and what they mean for the future of the internet.&lt;br /&gt;

&lt;img alt=&quot;Five Technologies That Will Keep Shaping the Web in 2010&quot; height=&quot;250&quot; src=&quot;http://images.sixrevisions.com/2009/12/12-01_technologies_shape_web_lead_image.jpg&quot; width=&quot;550&quot; /&gt;&lt;br /&gt;

&lt;span id=&quot;more-2153&quot;&gt;&lt;/span&gt;&lt;br /&gt;

&lt;h3&gt;
1. CSS3, HTML5 and Fonts as a Service&lt;/h3&gt;
&lt;img alt=&quot;CSS3, HTML5 and Fonts as a Service&quot; height=&quot;210&quot; src=&quot;http://images.sixrevisions.com/2009/12/12-02_typekit_screenshot.jpg&quot; width=&quot;550&quot; /&gt;&lt;br /&gt;

CSS3, HTML5, and Fonts as a Service such as &lt;a href=&quot;http://typekit.com/&quot;&gt;Typekit&lt;/a&gt; that cater to web browsers that already support the &lt;a href=&quot;http://www.w3.org/TR/css3-fonts/#the-font-face-rule&quot;&gt;@font-face rule&lt;/a&gt;, are giving web designers the creative freedom that they have been coveting for a long time.&lt;br /&gt;

CSS3 is opening up various new options for styling content on the web, from &lt;a href=&quot;http://www.css3.info/preview/multiple-backgrounds/&quot;&gt;multiple backgrounds&lt;/a&gt; on page elements, better ability to select and style elements with greater specificity, and &lt;a href=&quot;http://www.css3.info/webkit-provides-implementation-of-css-based-gradients/&quot;&gt;color gradients&lt;/a&gt;
 without reliance on static graphics, to simpler aesthetical 
improvements such as support for rounded corners without the need for 
complicated &lt;a href=&quot;http://www.alistapart.com/articles/slidingdoors/&quot;&gt;sliding doors techniques&lt;/a&gt; or JavaScript. &lt;br /&gt;

HTML5 is slowly but surely changing the way we mark up our pages, 
bringing us closer to the holy grail of the semantic web, opening up 
native support for open format multimedia such as video and audio, and 
bringing us better ways to interoperate with the content of a website.&lt;br /&gt;

Another change that web designers have been wishing for is being able to use any font on a web page, without using static &lt;a href=&quot;http://www.mezzoblue.com/tests/revised-image-replacement/&quot;&gt;CSS background image replacement&lt;/a&gt;
 or relying on JavaScript and Flash. The development of tools like 
Typekit and greater support for the @font-face rule are enabling site 
builders to use a much wider range of fonts in their design.&lt;br /&gt;

&lt;h4&gt;
So what will change?&lt;/h4&gt;
These are all web technologies that are guaranteed to make the web a 
more aesthetically pleasing place. Of course, expect these new things to
 be misused by Sunday driver designers; there will be some horrible font
 choices and misemployed color gradients that will produce unreadable 
and tacky page designs, but it’s the opportunities that they open up for
 capable and creative designers that will be most &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/230452415134454498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/230452415134454498' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/230452415134454498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/230452415134454498'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/five-technologies-that-will-keep.html' title='Five Technologies That Will Keep Shaping the Web'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-5882933075832503393</id><published>2012-01-01T23:20:00.000-08:00</published><updated>2012-01-01T23:20:46.005-08:00</updated><title type='text'>Ajax: A New Approach to Web Applications</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
If anything about current interaction design can be called 
“glamorous,” it’s creating Web applications. After all, when was the 
last time you heard someone rave about the interaction design of a 
product that wasn’t on the Web? (Okay, besides the iPod.) All the cool, 
innovative new projects are online.&lt;br /&gt;


Despite this, Web interaction designers can’t help but feel a little 
envious of our colleagues who create desktop software. Desktop 
applications have a richness and responsiveness that has seemed out of 
reach on the Web. The same simplicity that enabled the Web’s rapid 
proliferation also creates a gap between the experiences we can provide 
and the experiences users can get from a desktop application.&lt;br /&gt;


That gap is closing. Take a look at &lt;a href=&quot;http://www.google.com/webhp?complete=1&amp;amp;hl=en&quot;&gt;Google Suggest&lt;/a&gt;. Watch the way the suggested terms update as you type, almost instantly. Now look at &lt;a href=&quot;http://maps.google.com/&quot;&gt;Google Maps&lt;/a&gt;.
 Zoom in. Use your cursor to grab the map and scroll around a bit. 
Again, everything happens almost instantly, with no waiting for pages to
 reload.&lt;br /&gt;


Google Suggest and Google Maps are two examples of a new approach to 
web applications that we at Adaptive Path have been calling Ajax. The 
name is shorthand for Asynchronous JavaScript + XML, and it represents a
 fundamental shift in what’s possible on the Web.&lt;br /&gt;


&lt;h2&gt;
Defining Ajax&lt;/h2&gt;
Ajax isn’t a technology. It’s really several technologies, each 
flourishing in its own right, coming together in powerful new ways. Ajax
 incorporates:&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://adaptivepath.com/publications/essays/archives/000266.php&quot;&gt;standards-based presentation&lt;/a&gt; using XHTML and CSS;&lt;/li&gt;
&lt;li&gt;dynamic display and interaction using the &lt;a href=&quot;http://www.scottandrew.com/weblog/articles/dom_1&quot;&gt;Document Object Model&lt;/a&gt;;&lt;/li&gt;
&lt;li&gt;data interchange and manipulation using &lt;a href=&quot;http://www-106.ibm.com/developerworks/xml/library/x-xslt/?article=xr&quot;&gt;XML and XSLT&lt;/a&gt;;&lt;/li&gt;
&lt;li&gt;asynchronous data retrieval using &lt;a href=&quot;http://www.xml.com/pub/a/2005/02/09/xml-http-request.html&quot;&gt;XMLHttpRequest&lt;/a&gt;;&lt;/li&gt;
&lt;li&gt;and &lt;a href=&quot;http://www.crockford.com/javascript/javascript.html&quot;&gt;JavaScript&lt;/a&gt; binding everything together.&lt;/li&gt;
&lt;/ul&gt;
The classic web application model works like this: Most user actions 
in the interface trigger an HTTP request back to a web server. The 
server does some processing—retrieving data, crunching numbers, talking 
to various legacy systems—and then returns an HTML page to the client. 
It’s a model adapted from the Web’s original use as a hypertext medium, 
but as fans of &lt;a href=&quot;http://www.jjg.net/elements/&quot;&gt;The Elements of User Experience&lt;/a&gt; know, what makes the Web good for hypertext doesn’t necessarily make it good for software applications.&lt;br /&gt;


&lt;a href=&quot;http://adaptivepath.com/uploads/archive/images/publications/essays/ajax-fig1.png&quot;&gt;&lt;img alt=&quot;Ajax Overview 1&quot; border=&quot;0&quot; height=&quot;455&quot; src=&quot;http://adaptivepath.com/uploads/archive/images/publications/essays/ajax-fig1_small.png&quot; width=&quot;475&quot; /&gt;&lt;/a&gt;&lt;br /&gt;


&lt;em&gt;Figure 1: The traditional model for web applications (left) compared to the Ajax model (right).&lt;/em&gt;&lt;br /&gt;


This approach makes a lot of technical sense, but it doesn’t make for
 a great user experience. While the server is doing its thing, what’s 
the user doing? That’s right, waiting. And at every step in a task, the 
user waits some more.&lt;br /&gt;


Obviously, if we were designing the Web from scratch for 
applications, we wouldn’t make users wait around. Once an interface is 
loaded, why should the user interaction come to a halt every time the 
application needs something from the server? In fact, why should the 
user see the application go to the server at all?&lt;br /&gt;


&lt;h2&gt;
How Ajax is Different&lt;/h2&gt;
An Ajax application eliminates the start-stop-start-stop nature of 
interaction on the Web by introducing an intermediary—an Ajax 
engine—between the user and the server. It seems like adding a layer to 
the application would make it less responsive, but the opposite is true.&lt;br /&gt;


Instead of loading a webpage, at the start of the session, the 
browser loads an Ajax engine—written in JavaScript and usually tucked 
away in a hidden frame. This engine is responsible for both rendering 
the interface the user sees and communicating with the server on the 
user’s behalf. The Ajax engine allows the user’s interaction with the 
application to happen asynchronously—independent of communication with 
the server. So the user is never staring at a blank browser window and 
an hourglass icon, waiting around for the server to do something.&lt;br /&gt;


&lt;a href=&quot;http://adaptivepath.com/uploads/archive/images/publications/essays/ajax-fig2.png&quot;&gt;&lt;img alt=&quot;Ajax Overview 2&quot; border=&quot;0&quot; height=&quot;598&quot; src=&quot;http://adaptivepath.com/uploads/archive/images/publications/essays/ajax-fig2_small.png&quot; width=&quot;475&quot; /&gt;&lt;/a&gt;&lt;br /&gt;


&lt;em&gt;Figure 2: The synchronous interaction pattern of a traditional 
web application (top) compared with the asynchronous pattern of an Ajax 
application (bottom).&lt;/em&gt;&lt;br /&gt;


Every user action that normally would generate an HTTP request takes 
the form of a JavaScript call to the Ajax engine instead. Any response 
to a user action that doesn’t require a trip back to the server—such as 
simple data validation, editing data in memory, and even some 
navigation—the engine handles on its own. If the engine needs something 
from the server in order to respond—if it’s submitting data for 
processing, loading additional interface code, or retrieving new 
data—the engine makes those requests asynchronously, usually using XML, 
without stalling a user’s interaction with the application.&lt;br /&gt;


&lt;h2&gt;
Who’s Using Ajax&lt;/h2&gt;
Google is making a huge investment in developing the Ajax approach. 
All of the major products Google has introduced over the last year—&lt;a href=&quot;http://www.orkut.com/&quot;&gt;Orkut&lt;/a&gt;, &lt;a href=&quot;http://www.gmail.com/&quot;&gt;Gmail&lt;/a&gt;, the latest beta version of &lt;a href=&quot;http://groups-beta.google.com/&quot;&gt;Google Groups&lt;/a&gt;, &lt;a href=&quot;http://www.google.com/webhp?complete=1&amp;amp;hl=en&quot;&gt;Google Suggest&lt;/a&gt;, and &lt;a href=&quot;http://maps.google.com/&quot;&gt;Google Maps&lt;/a&gt;—are
 Ajax applications. (For more on the technical nuts and bolts of these 
Ajax implementations, check out these excellent analyses of &lt;a href=&quot;http://johnvey.com/features/gmailapi/&quot;&gt;Gmail&lt;/a&gt;, &lt;a href=&quot;http://serversideguy.blogspot.com/2004/12/google-suggest-dissected.html&quot;&gt;Google Suggest&lt;/a&gt;, and &lt;a href=&quot;http://web.archive.org/web/20050331002145/jgwebber.blogspot.com/2005/02/mapping-google.html&quot;&gt;Google Maps&lt;/a&gt;.) Others are following suit: many of the features that people love in &lt;a href=&quot;http://www.flickr.com/&quot;&gt;Flickr&lt;/a&gt; depend on Ajax, and Amazon’s &lt;a href=&quot;http://www.a9.com/&quot;&gt;A9.com&lt;/a&gt; search engine applies similar techniques.&lt;br /&gt;


These projects demonstrate that Ajax is not only technically sound, 
but also practical for real-world applications. This isn’t another 
technology that only works in a laboratory. And Ajax applications can be
 any size, from the very simple, single-function Google Suggest to the 
very complex and sophisticated Google Maps.&lt;br /&gt;


At Adaptive Path, we’ve been doing our own work with Ajax over the 
last several months, and we’re realizing we’ve only scratched the 
surface of the rich interaction and responsiveness that Ajax 
applications can provide. Ajax is an important development for Web 
applications, and its importance is only going to grow. And because 
there are so many developers out there who already know how to use these
 technologies, we expect to see many more organizations following 
Google’s lead in reaping the competitive advantage Ajax provides.&lt;br /&gt;


&lt;h2&gt;
Moving Forward&lt;/h2&gt;
The biggest challenges in creating Ajax applications are not 
technical. The core Ajax technologies are mature, stable, and well 
understood. Instead, the challenges are for the designers of these 
applications: to forget what we think we know about the limitations of 
the Web, and begin to imagine a wider, richer range of possibilities.&lt;br /&gt;


It’s going to be fun.&lt;br /&gt;


&lt;hr /&gt;


&lt;a href=&quot;&quot; name=&quot;qanda&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;h2&gt;
&lt;a href=&quot;&quot; name=&quot;qanda&quot;&gt;Ajax Q&amp;amp;A&lt;/a&gt;&lt;/h2&gt;
&lt;strong&gt;March 13, 2005:&lt;/strong&gt; Since we first published Jesse’s essay,
 we’ve received an enormous amount of correspondence from readers with 
questions about Ajax. In this Q&amp;amp;A, Jesse responds to some of the 
most common queries.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Did Adaptive Path invent Ajax? Did Google? Did Adaptive Path help build Google’s Ajax applications?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; Neither Adaptive Path nor Google invented Ajax. 
Google’s recent products are simply the highest-profile examples of Ajax
 applications. Adaptive Path was not involved in the development of 
Google’s Ajax applications, but we have been doing Ajax work for some of
 our other clients.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Is Adaptive Path selling Ajax components or trademarking the name? Where can I download it?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; Ajax isn’t something you can download. It’s an 
approach—a way of thinking about the architecture of web applications 
using certain technologies. Neither the Ajax name nor the approach are 
proprietary to Adaptive Path.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Is Ajax just another name for XMLHttpRequest?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; No. XMLHttpRequest is only part of the Ajax 
equation. XMLHttpRequest is the technical component that makes the 
asynchronous server communication possible; Ajax is our name for the 
overall approach described in the article, which relies not only on 
XMLHttpRequest, but on CSS, DOM, and other technologies.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Why did you feel the need to give this a name?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; I needed something shorter than “Asynchronous 
JavaScript+CSS+DOM+XMLHttpRequest” to use when discussing this approach 
with clients.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Techniques for asynchronous server communication have been around for years. What makes Ajax a “new” approach?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; What’s new is the prominent use of these techniques 
in real-world applications to change the fundamental interaction model 
of the Web. Ajax is taking hold now because these technologies and the 
industry’s understanding of how to deploy them most effectively have 
taken time to develop.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Is Ajax a technology platform or is it an architectural style?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; It’s both. Ajax is a set of technologies being used together in a particular way.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; What kinds of applications is Ajax best suited for?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; We don’t know yet. Because this is a relatively new 
approach, our understanding of where Ajax can best be applied is still 
in its infancy. Sometimes the traditional web application model is the 
most appropriate solution to a problem.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Does this mean Adaptive Path is anti-Flash?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; Not at all. Macromedia is an Adaptive Path client, 
and we’ve long been supporters of Flash technology. As Ajax matures, we 
expect that sometimes Ajax will be the better solution to a particular 
problem, and sometimes Flash will be the better solution. We’re also 
interested in exploring ways the technologies can be mixed (as in the 
case of Flickr, which uses both).
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Does Ajax have significant accessibility or browser 
compatibility limitations? Do Ajax applications break the back button? 
Is Ajax compatible with REST? Are there security considerations with 
Ajax development? Can Ajax applications be made to work for users who 
have JavaScript turned off?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; The answer to all of these questions is “maybe”. 
Many developers are already working on ways to address these concerns. 
We think there’s more work to be done to determine all the limitations 
of Ajax, and we expect the Ajax development community to uncover more 
issues like these along the way.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Some of the Google examples you cite don’t use XML at all. Do I have to use XML and/or XSLT in an Ajax application?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; No. XML is the most fully-developed means of getting
 data in and out of an Ajax client, but there’s no reason you couldn’t 
accomplish the same effects using a technology like &lt;a href=&quot;http://www.crockford.com/JSON/&quot;&gt;JavaScript Object Notation&lt;/a&gt; or any similar means of structuring data for interchange.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Are Ajax applications easier to develop than traditional web applications?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; Not necessarily. Ajax applications inevitably 
involve running complex JavaScript code on the client. Making that 
complex code efficient and bug-free is not a task to be taken lightly, 
and better development tools and frameworks will be needed to help us 
meet that challenge.
&lt;br /&gt;



&lt;strong&gt;Q.&lt;/strong&gt; Do Ajax applications always deliver a better experience than traditional web applications?
&lt;br /&gt;



&lt;strong&gt;A.&lt;/strong&gt; Not necessarily. Ajax gives interaction designers 
more flexibility. However, the more power we have, the more caution we 
must use in exercising it. We must be careful to use Ajax to enhance the
 user experience of our applications, not degrade it.
&lt;br /&gt;



 
  This entry was posted on Friday, February 18, 2005 at 3:36 am, and is filed under &lt;a href=&quot;http://adaptivepath.com/ideas/category/technology&quot;&gt;Technology and Trends&lt;/a&gt;.   &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/5882933075832503393/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/5882933075832503393' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/5882933075832503393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/5882933075832503393'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/ajax-new-approach-to-web-applications.html' title='Ajax: A New Approach to Web Applications'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2681547179890084254.post-4811420932313563260</id><published>2012-01-01T23:18:00.000-08:00</published><updated>2012-01-01T23:18:10.099-08:00</updated><title type='text'>Top 10 Business Web Site Mistakes inShare1 Share4 Print Print   Source: http://www.allbusiness.com/technology/internet-web-development/4015-1.html#ixzz1iHbW44Wk</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Today it takes more than just having a Web site to make the Internet 
work for your company. Sites are highly competitive, and proper site 
design has become an area of concern to businesses that want to use the 
Internet to the fullest. Below are 10 common Web site errors that occur.
&lt;br /&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Inappropriate domain name:&lt;/strong&gt; Pick a domain name 
that is memorable and relates to your business. Since people are likely 
to forget very long names, shorter domain names are typically better, 
but not always. For example, a name like Peter.com can be too vague and 
says nothing about the content of the Web site. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Poor design and functionality:&lt;/strong&gt; Why have a Web 
site with content if no one can access it? Good design is largely based 
on consistency. Menus should appear in the same place on every page, 
links should all be the same color/typeface, and a logo of some sort 
should be clearly visible at all times. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Too complicated or too slow:&lt;/strong&gt; Although flash 
animation may look amazing, it may be too complex for casual Internet 
users. Though aesthetics certainly matter, it must be in balance with 
functionality and ease of use for the typical user. Also, a more complex
 design takes longer to load on many computers. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Stagnant site:&lt;/strong&gt; Not only is content 
time-sensitive, so is format and design. There will always be new tools 
available to make Web sites better looking and better performing. It is 
not cost-effective to create a Web site and let it sit. Update content 
regularly and take advantage of (appropriate) new technologies to make 
the site look better. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Broken links and 404 error messages: &lt;/strong&gt;Make sure 
every link on your site works. You&#39;ll lose users quickly if they see a 
&quot;404 file not found&quot; error message or find broken or incorrectly labeled
 links. If you have a large site, consider adding a form so users can 
submit a broken link, which lets users know you are on top of any 
problems they discover. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No contact info:&lt;/strong&gt; Users need to be able to contact
 you with questions, complaints, and suggestions. A Contact Us page, 
like an Internet business card, should be available from any part of 
your site. Also, be sure to actually answer these messages either 
personally or through an auto-reply. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ignoring statistics:&lt;/strong&gt; Detailed reports of visitor 
traffic are available for your Web site. This service may be offered by 
your hosting provider or obtained through a third party. By monitoring 
your statistics (such as visitors-turned-customers, users on broadband, 
etc.) you can tailor your marketing and design toward those who visit 
most or find weak spots based on who you are not attracting. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Free or cheap hosting:&lt;/strong&gt; As attractive as some of 
these services are, realize that the reliability of your business 
depends on the reliability of your hosting. A good host service should 
have minimal downtime, offer services such as shopping cart systems, and
 have good customer support. Be sure to read reviews and apply for free 
trials (if possible) before you commit to anything. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Avoiding spiders:&lt;/strong&gt; Spiders are what search engines
 use to find your page. You want to make sure your pages are designed so
 that you show up high on search engine rankings. This process is called
 search engine optimization. There are, however, ethics and strategies 
to SEO. Some practices (such as hidden text, redirects, etc.) will 
result in you being banned from search engines. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Not hiring a professional:&lt;/strong&gt; Search engine 
optimization is complex. To move up in the listings on Google and other 
search engines, you may want to hire a professional, especially if your 
business relies heavily on generating business from the Web. &lt;/li&gt;
&lt;/ol&gt;
For more information, check out the &lt;a href=&quot;http://www.allbusiness.com/4968351-1.html&quot;&gt;Internet and WWW&lt;/a&gt; section of AllBusiness.com&#39;s Internet &amp;amp; E-commerce Center.
&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: medium none; color: black; overflow: hidden; text-align: left; text-decoration: none;&quot;&gt;
&lt;br /&gt;Source: &lt;a href=&quot;http://www.allbusiness.com/technology/internet-web-development/4015-1.html#ixzz1iHbfzHtN&quot; style=&quot;color: #003399;&quot;&gt;http://www.allbusiness.com/technology/internet-web-development/4015-1.html#ixzz1iHbfzHtN&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://madaninfo.blogspot.com/feeds/4811420932313563260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/2681547179890084254/4811420932313563260' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/4811420932313563260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2681547179890084254/posts/default/4811420932313563260'/><link rel='alternate' type='text/html' href='http://madaninfo.blogspot.com/2012/01/top-10-business-web-site-mistakes.html' title='Top 10 Business Web Site Mistakes inShare1 Share4 Print Print   Source: http://www.allbusiness.com/technology/internet-web-development/4015-1.html#ixzz1iHbW44Wk'/><author><name>Tech Interface</name><uri>http://www.blogger.com/profile/02284972847218006930</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>