SlideShare a Scribd company logo
1 of 46
 
 HTML5 Design Principles
 HTML5 Feature Detection and Modernizer.js
 HTML 5 new elements and attributes
 Media
 Drawing using:
o Canvas
o SVG
 Geolocation
 Compatibiliy:
o Support existing content
o Degrade gracefully
o Do not reinvent the wheel
o Pave the cowpaths
o Evolution not revolution
 Utility:
o Separation of concerns
o DOM consistency
 Interoperability
o Well defined behavior
o Avoid needless complexity
o Handles errors
if (navigator.geolocation){
//supported
} else{
//not supported
}
 Modernizr is an open source, MIT-licensed JavaScript
library that detects support for many HTML5 & CSS3
features.
 Creates a global object called Modernizr
if (Modernizr.canvas) {
// let's draw some shapes!
} else {
// no native canvas support available :(
}
 <section> is a sematic grouping of content, typically with
a heading.
o Web site's home page introduction, news items, contact
information.
 <nav> is a section of a page that links to other pages or
to parts within the page
 <article> represents a component of a page that consists
of a self-contained composition
o a forum post, a magazine or newspaper article, a Web log entry,
a user-submitted comment, an interactive widget or gadget
 <aside> Used for advertising, for groups of nav
elements, and for other content that is considered
separate from the main content of the page.
 <section id="main">
o <article> <!-- first blog post content goes here --> </article>
o <article> <!-- second blog post content goes here -->
o </article> <article> <!-- third blog post content goes here -->
</article>
 </section>
 <article>
o <section id="introduction"> </section>
o <section id="content"> </section>
o <section id="summary"> </section>
 </article>
 <time> represents either a time on a 24 hour clock, or a
precise date
 <mark> represents text marked or highlighted
 <figure> and <figcaption> represent an image, chart or
code examples
o <figure>
o <img src="path/to/image" alt="About image" />
o <figcaption>
o <p>This is an image of something interesting. </p>
o </figcaption>
o </figure>
 <hgroup> to group a set of h1–h6 elements when the
heading has multiple levels.
 <header> contain the section’s heading (an h1–h6
element or an hgroup element) or section’s table of
contents, a search form, or any relevant logos.
 <footer> represents a footer for a sectioning content or
sectioning root element. A footer typically contains
information about its section such as who wrote it, links
to related documents, copyright data, and the like.
<header>
<hgroup>
<h1>My Weblog</h1>
<h2>A lot of effort went into making this effortless.</h2>
</hgroup>
<nav>
<ul>
<li><a href="../semantics.html">home</a></li>
<li><a href="../semantics.html">blog</a></li>
<li><a href="../semantics.html">gallery</a></li>
<li><a href="../semantics.html">about</a></li>
</ul>
</nav>
</header>
<header>
<hgroup>
<h1>My Weblog</h1>
<h2>A lot of effort went into making this effortless.</h2>
</hgroup>
<nav>
<ul>
<li><a href="../semantics.html">home</a></li>
<li><a href="../semantics.html">blog</a></li>
<li><a href="../semantics.html">gallery</a></li>
<li><a href="../semantics.html">about</a></li>
</ul>
</nav>
</header>
<article>
<header>
<time datetime="2009-10-22" pubdate>October 22, 2009</time>
<h1>
<a href="../semantics.html" title="link to this post">Travel day</a>
</h1>
</header>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
hendrerit felis accumsan turpis pretium tempor. Duis eu turpis nunc, ut
euismod nisl. Aliquam erat volutpat. Proin eu eros mollis dui fringilla
sodales. Curabitur venenatis tincidunt felis ac congue. Maecenas at
odio dui, sit amet congue sapien.
</p >
</article>
<input list="browsers">
<datalist id="browsers">
<option value="Others">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Chrome Mobile">
<option value="Opera">
<option value="Safari">
</datalist>
<input type="color" >
<input type=“date" >
 email  contain an e-mail address, the e-mail address will be
automatically validated when submitted.
 month  to select a month and year, a date picker will show
up in the input field.
 number  contain a numeric value.
o .max Specifies the maximum value for an input field
o .min Specifies the minimum value for an input field
o .pattern Specifies a regular exp to check the input value against
o .step Specifies the legal number intervals for an input field
o .stepUp(n) increases the field’s value by n.
o .stepDown(n) decreases the field’s value by n.
o .valueAsNumber returns the current value as a floating point
number.
o <input type="number" name="points" min="0" max="100" step
="10" value="30">
 range  contain a value within a range, the input field will be
displayed as a slider control. The default values from 0 to 100
 <input type="range" name="points" min="0" max="10">
 Some useful attributes: min, max, step.
 search  search fields (behaves like a regular text field).
Except that when you start typing in it a small cross appears
on the right side of the field. This helps clear the content fast.
 time  to select a time , a time picker can show up in the
input field.
 url  contain a URL address, the url field will be
automatically validated when submitted
 week  to select a week and year, a date picker will show up
in the input field.``
 New graphic elements:
o <svg> and <canvas>.
 New multimedia elements:
o <audio> and <video>.
 <video src="url/video.ogg" controls>
o Your browser does not support the <code>video</code>
element.
 </video>
 <audio src="/test/audio.ogg">
o <p>Your browser does not support the audio element.</p>
 </audio>
 Multiple Sources
 <video width="320" height="240" controls autoplay
loop >
o <source src="movie.mp4" type="video/mp4”>
o <source src="movie.ogg" type="video/ogg">
o Your browser does not support the video tag.
 </video>
 video/audio element methods:
o canPlayType() Checks if the browser can play the specified
audio/video type
o load() Re-loads the audio/video element
o play() Starts playing the audio/video
o pause() Pauses the currently playing audio/video
 video/audio element properties
o autoplay Sets/Gets whether the audio/video should start playing when loaded
o buffered Gets a TimeRanges of the buffered parts of the audio/video
o controls Sets/Gets whether the audio/video display controls
o currentSrc Gets the URL of the current audio/video
o currentTime Sets/Gets the current playback position (in seconds)
o defaultMuted Sets/Gets whether the audio/video should be muted by default
o defaultPlaybackRate Sets/Gets the default speed of the audio/video playback
o duration Gets the length of the current audio/video (in seconds)
o ended Gets whether the playback of the audio/video has ended or not
o error Gets a MediaError object, the error state of the audio/video
o loop Sets/Gets whether the audio/video automatically start over again
o muted Sets/Gets whether the audio/video is muted or not
o networkState Gets the current network state of the audio/video
o paused Gets whether the audio/video is paused or not
o playbackRate Sets/Gets the speed of the audio/video playback
o played Gets a TimeRanges object of the played parts of the audio/video
o preload Sets/Gets whether audio/video is loaded on page load
o readyState Gets the current ready state of the audio/video
o seekable Gets a TimeRanges object, the seekable parts of the audio/video
o seeking Gets whether the user is currently seeking in the audio/video
o src Sets/Gets the current source of the audio/video element
o startDate Gets a Date object representing the current time offset
o volume Sets/Gets the volume of the audio/video
 video/audio element events
o abort Fires when the loading is aborted
o canplay Fires when the browser can start playing
o canplaythrough Fires when the browser can play without stopping for buffering
o durationchange Fires when the duration is changed (after it is loaded)
o ended Fires when the audio/video has ended
o error Fires when an error occurred during loading
o loadeddata Fires when the browser has loaded the current frame
o loadedmetadata Fires when the browser has loaded meta data
o loadstart Fires when the browser starts looking for the audio/video
o pause Fires when been paused
o play Fires when started or is not paused
o playing Fires when playing after being paused or stopped for
buffering
o progress Fires when downloading the audio/video
o ratechange Fires when the playing speed is changed
o seeked Fires when the user finish moving/skipping to a new position
o seeking Fires when the user starts moving/skipping to a new position
o stalled Fires when browser is trying to get media data, but data is N/A
o suspend Fires when the browser is intentionally not getting media data
o timeupdate Fires when the current playback position has changed
o volumechange Fires when the volume has been changed
o waiting Fires when the video stops to buffer the next frame
 loadstart 
o durationchange 
• loadedmetadata 
• loadeddata 
• progress 
• canplay 
• canplaythrough
 Canvas:
“a strong, coarse unbleached cloth used to make items such as sails and tents and as a
surface for oil painting.”
 Used to:
o draw graphics,
o make photo compositions, real-time video processing or rendering.
o create animations
 The default size of the canvas is 300 px × 150 px (width × height).
o <canvas id="c1"></canvas>
o <script>
o var canvas = document.getElementById("c1");
o var ctx = canvas.getContext("2d");
o ctx.fillStyle = "green";
o ctx.fillRect(10, 10, 100, 100);
o </script>
 Color
o ctx.fillStyle = "green";
o ctx.strokeStyle = "green”;
o fillStyle and strokeStyle sets the colors used for rendering
filled/framed shapes
o Can use gradient object or a pattern
 To clear canvas:
o ctx.clearRect(x,y,width,height);
How to creates
a gradients or
a pattern?
 Line:
o to move to the starting point, Set the endpoint,
o Draw a line between them
• ctx.moveTo(60,0);
• ctx.lineTo(60,153);
• ctx.stroke();
 You can set multiple line to be drawn at once instead using path
o ctx.beginPath();
o ctx.strokeStyle="red";
o ctx.moveTo(60,173);
o ctx.lineTo(60,375);
o ctx.moveTo(60,390);
o ctx.lineTo(270,390);
o ctx.moveTo(270,375);
o ctx.lineTo(270,173);
o ctx.stroke();
o ctx.closePath();
 Rectangle
o ctx.fillRect(10, 10, 100, 100); // x, y, width, height
o ctx.strokeRect(10,10,100,100) // only edges , no fill
o ctx.clearRect(10,10,100,100) // clear part of the canvas rep.
by the rect
 Arc/Circles
o ctx.arc(x,y,radius,startAngle,endAngle,anticlockwise)
 Text
o ctx.font=”bold 12px sans-serif”; // CSS font rule
o ctx.textAlign=”center”; //start, end, left, right, center
o ctx.fillText(“str”,x,y); // print str as a text starting from
x and y
 Read more on Bezier and quadratic curves in
o https://developer.mozilla.org/en-
US/docs/web/api/canvas_api/tutorial/drawing_shapes#Bezier_an
d_quadratic_curves
 Scalable Vector Graphics
o Describes 2D graphics in XML
o Ideal for handling different screen sizes
o Resolution independent
 <svg id=“svgelem” height=“200” xmlns=“”>
o <circle id=“redcircle” cx=“50” cy=“50” r=“50” fill=“red” />
 </svg>
http://www.w3.org/TR/SVG/

The QUESTION is:
 navigator.geolocation object
 Getting the current position
o getCurrentPosition( sucesscallback, errorcallback, geo_options)
o navigator.geolocation.getCurrentPosition(function(position) {
alert(position.coords.latitude+”-”+position.coords.longitude);
});
 Watching the current position
o watchPosition(successcallback, errorcallback, geo_options)
 PositionOptions Object
o var geo_options = {
o enableHighAccuracy: true,
o maximumAge : 30000,
o timeout : 27000
o };
 Steps:
o Define a draggable target using draggable attribute
o Define data to be dragged (ondragstart)
• Text, Links, HTML and XML
• Files, Images
• Document Nodes
o Define custom drag feedback image
o Define drag effect
• copy, move, link
o Define Drop area
o Do something when drop occurs
http://html5demos.com/drag
 Drag Events
o dragstart
o dragenter
o dragover
o dragleave
o drag
o drop
o dragend
 Default drag behaviour
o text selection
o Images
o links
 To make other elements draggable
o Set draggable=true
o Add a listener for the dragstart events
o Set drag data within the listener defined above
 <div draggable="true"
ondragstart="event.dataTransfer.setData('text/plain', 'This text
may be dragged')”>
o This text <strong>may</strong> be dragged.
 </div>
 dragstart event used to:
o Specify drag data
• Drag event has property dataTransfer contains format and value
o Feedback image
o Drag effect
 dragenter/dragover event for drop target elements
o Can be used to check whether drop is allowed to be dropped by
checking dataTransfer data type/format
 dragstart event used to:
o Specify drag data
• Drag event has property dataTransfer contains format and value
o Feedback image
o Drag effect
 Dropping
o Handle Drop event
• Prevent browser default behavior (redirection)
 First there were cookies
o Included in each request
o Max 4KB
o Can be turned off
 HTML5 Web Storage:
o Local Storage
o Session Storage
 Persist data for the duration of the page session.
o As long as browser is open, survive reloads
o New tab/ new window  new session
 Add/edit/delete the sessionStorage object
 Saved in a key/value pair
o sessionStorage.setItem(‘name’,’John’); Or
sessionStorage.name=‘John’
o var item=sessionStorage.getItem(‘name’);
o sessionStorage.removeItem(‘name’);
o sessionStorage.clear();
 Persist data until history cleared
 Add/edit/delete the localStorage object
 Saved in a key/value pair
o localStorage.setItem(‘name’,’John’); Or
localStorage.name=‘John’
o var item=localStorage.getItem(‘name’);
o localStorage.removeItem(‘name’);
o localStorage.clear();
 Serialize them into JSON string then save them
o JSON.stringify(jsobject)  json string
 When retrieving deserialize the JSON string into an
object
o JSON.parse(jsonstr)  javascript object
 What is HTML 5 Microdata?
 What is Web Worker API?
 What is Application Cache?
 What is IndexedDB?

More Related Content

What's hot

Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQueryRemy Sharp
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerymanugoel2003
 
David Kopal - Unleash the power of the higher-order components
David Kopal - Unleash the power of the higher-order componentsDavid Kopal - Unleash the power of the higher-order components
David Kopal - Unleash the power of the higher-order componentsOdessaJS Conf
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginningAnis Ahmad
 
PHP Loves MongoDB - Dublin MUG (by Hannes)
PHP Loves MongoDB - Dublin MUG (by Hannes)PHP Loves MongoDB - Dublin MUG (by Hannes)
PHP Loves MongoDB - Dublin MUG (by Hannes)Mark Hillick
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue AdventureAllegient
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryQConLondon2008
 
Ruby is Awesome
Ruby is AwesomeRuby is Awesome
Ruby is AwesomeAstrails
 
The Ring programming language version 1.5.2 book - Part 42 of 181
The Ring programming language version 1.5.2 book - Part 42 of 181The Ring programming language version 1.5.2 book - Part 42 of 181
The Ring programming language version 1.5.2 book - Part 42 of 181Mahmoud Samir Fayed
 
Corinna Status 2022.pptx
Corinna Status 2022.pptxCorinna Status 2022.pptx
Corinna Status 2022.pptxCurtis Poe
 
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDBMongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDBMongoDB
 
How to Handle NoSQL with a Relational Database
How to Handle NoSQL with a Relational DatabaseHow to Handle NoSQL with a Relational Database
How to Handle NoSQL with a Relational DatabaseDATAVERSITY
 
JavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScriptJavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScriptLaurence Svekis ✔
 
CSS Algorithms - v3.6.1 @ Strange Loop
CSS Algorithms - v3.6.1 @ Strange LoopCSS Algorithms - v3.6.1 @ Strange Loop
CSS Algorithms - v3.6.1 @ Strange LoopLara Schenck
 

What's hot (16)

Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
David Kopal - Unleash the power of the higher-order components
David Kopal - Unleash the power of the higher-order componentsDavid Kopal - Unleash the power of the higher-order components
David Kopal - Unleash the power of the higher-order components
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
PHP Loves MongoDB - Dublin MUG (by Hannes)
PHP Loves MongoDB - Dublin MUG (by Hannes)PHP Loves MongoDB - Dublin MUG (by Hannes)
PHP Loves MongoDB - Dublin MUG (by Hannes)
 
Html5 For Jjugccc2009fall
Html5 For Jjugccc2009fallHtml5 For Jjugccc2009fall
Html5 For Jjugccc2009fall
 
jQuery Rescue Adventure
jQuery Rescue AdventurejQuery Rescue Adventure
jQuery Rescue Adventure
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
Ruby is Awesome
Ruby is AwesomeRuby is Awesome
Ruby is Awesome
 
The Ring programming language version 1.5.2 book - Part 42 of 181
The Ring programming language version 1.5.2 book - Part 42 of 181The Ring programming language version 1.5.2 book - Part 42 of 181
The Ring programming language version 1.5.2 book - Part 42 of 181
 
Corinna Status 2022.pptx
Corinna Status 2022.pptxCorinna Status 2022.pptx
Corinna Status 2022.pptx
 
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDBMongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
 
How to Handle NoSQL with a Relational Database
How to Handle NoSQL with a Relational DatabaseHow to Handle NoSQL with a Relational Database
How to Handle NoSQL with a Relational Database
 
jQuery
jQueryjQuery
jQuery
 
JavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScriptJavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScript
 
CSS Algorithms - v3.6.1 @ Strange Loop
CSS Algorithms - v3.6.1 @ Strange LoopCSS Algorithms - v3.6.1 @ Strange Loop
CSS Algorithms - v3.6.1 @ Strange Loop
 

Similar to HTML5 Design and Semantic Elements

Brave new world of HTML5
Brave new world of HTML5Brave new world of HTML5
Brave new world of HTML5Chris Mills
 
webinale2011_Chris Mills_Brave new world of HTML5Html5
webinale2011_Chris Mills_Brave new world of HTML5Html5webinale2011_Chris Mills_Brave new world of HTML5Html5
webinale2011_Chris Mills_Brave new world of HTML5Html5smueller_sandsmedia
 
What you need to know bout html5
What you need to know bout html5What you need to know bout html5
What you need to know bout html5Kevin DeRudder
 
DV10 HTML5: The Future of Web Development
DV10 HTML5: The Future of Web Development DV10 HTML5: The Future of Web Development
DV10 HTML5: The Future of Web Development Ronald Widha
 
Fii Practic Frontend - BeeNear - laborator 4
Fii Practic Frontend - BeeNear - laborator 4Fii Practic Frontend - BeeNear - laborator 4
Fii Practic Frontend - BeeNear - laborator 4BeeNear
 
Html5 tutorial
Html5 tutorialHtml5 tutorial
Html5 tutorialmadhavforu
 
Graphics & Animation with HTML5
Graphics & Animation with HTML5Graphics & Animation with HTML5
Graphics & Animation with HTML5Knoldus Inc.
 
Web Directions @media 2010
Web Directions @media 2010Web Directions @media 2010
Web Directions @media 2010Patrick Lauke
 
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....Patrick Lauke
 
Top 10 HTML5 features every developer should know!
Top 10 HTML5 features every developer should know!Top 10 HTML5 features every developer should know!
Top 10 HTML5 features every developer should know!Gill Cleeren
 
Html attributes
Html attributesHtml attributes
Html attributesMekbib1
 

Similar to HTML5 Design and Semantic Elements (20)

Web Apps
Web AppsWeb Apps
Web Apps
 
Html5 intro
Html5 introHtml5 intro
Html5 intro
 
Brave new world of HTML5
Brave new world of HTML5Brave new world of HTML5
Brave new world of HTML5
 
webinale2011_Chris Mills_Brave new world of HTML5Html5
webinale2011_Chris Mills_Brave new world of HTML5Html5webinale2011_Chris Mills_Brave new world of HTML5Html5
webinale2011_Chris Mills_Brave new world of HTML5Html5
 
What you need to know bout html5
What you need to know bout html5What you need to know bout html5
What you need to know bout html5
 
DV10 HTML5: The Future of Web Development
DV10 HTML5: The Future of Web Development DV10 HTML5: The Future of Web Development
DV10 HTML5: The Future of Web Development
 
Html 5
Html 5Html 5
Html 5
 
Fii Practic Frontend - BeeNear - laborator 4
Fii Practic Frontend - BeeNear - laborator 4Fii Practic Frontend - BeeNear - laborator 4
Fii Practic Frontend - BeeNear - laborator 4
 
Html5
Html5Html5
Html5
 
Html5 tutorial
Html5 tutorialHtml5 tutorial
Html5 tutorial
 
Graphics & Animation with HTML5
Graphics & Animation with HTML5Graphics & Animation with HTML5
Graphics & Animation with HTML5
 
Web Directions @media 2010
Web Directions @media 2010Web Directions @media 2010
Web Directions @media 2010
 
Html5
Html5Html5
Html5
 
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
HTML5 (and friends) - History, overview and current status - jsDay Verona 11....
 
HTML5 - Pedro Rosa
HTML5 - Pedro RosaHTML5 - Pedro Rosa
HTML5 - Pedro Rosa
 
Top 10 HTML5 features every developer should know!
Top 10 HTML5 features every developer should know!Top 10 HTML5 features every developer should know!
Top 10 HTML5 features every developer should know!
 
Html5
Html5Html5
Html5
 
Training HTML
Training HTMLTraining HTML
Training HTML
 
Html5
Html5Html5
Html5
 
Html attributes
Html attributesHtml attributes
Html attributes
 

More from Julie Iskander

More from Julie Iskander (20)

Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
C for Engineers
C for EngineersC for Engineers
C for Engineers
 
Design Pattern lecture 3
Design Pattern lecture 3Design Pattern lecture 3
Design Pattern lecture 3
 
Scriptaculous
ScriptaculousScriptaculous
Scriptaculous
 
Prototype Framework
Prototype FrameworkPrototype Framework
Prototype Framework
 
Design Pattern lecture 4
Design Pattern lecture 4Design Pattern lecture 4
Design Pattern lecture 4
 
Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2
 
Design Pattern lecture 1
Design Pattern lecture 1Design Pattern lecture 1
Design Pattern lecture 1
 
Ajax and ASP.NET AJAX
Ajax and ASP.NET AJAXAjax and ASP.NET AJAX
Ajax and ASP.NET AJAX
 
ASP.NET Lecture 5
ASP.NET Lecture 5ASP.NET Lecture 5
ASP.NET Lecture 5
 
ASP.NET lecture 8
ASP.NET lecture 8ASP.NET lecture 8
ASP.NET lecture 8
 
ASP.NET Lecture 7
ASP.NET Lecture 7ASP.NET Lecture 7
ASP.NET Lecture 7
 
ASP.NET Lecture 6
ASP.NET Lecture 6ASP.NET Lecture 6
ASP.NET Lecture 6
 
ASP.NET Lecture 4
ASP.NET Lecture 4ASP.NET Lecture 4
ASP.NET Lecture 4
 
ASP.NET Lecture 3
ASP.NET Lecture 3ASP.NET Lecture 3
ASP.NET Lecture 3
 
ASP.NET Lecture 2
ASP.NET Lecture 2ASP.NET Lecture 2
ASP.NET Lecture 2
 
ASP.NET Lecture 1
ASP.NET Lecture 1ASP.NET Lecture 1
ASP.NET Lecture 1
 
AJAX and JSON
AJAX and JSONAJAX and JSON
AJAX and JSON
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
DOM and Events
DOM and EventsDOM and Events
DOM and Events
 

Recently uploaded

Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 

Recently uploaded (20)

Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 

HTML5 Design and Semantic Elements

  • 2.  HTML5 Design Principles  HTML5 Feature Detection and Modernizer.js  HTML 5 new elements and attributes  Media  Drawing using: o Canvas o SVG  Geolocation
  • 3.  Compatibiliy: o Support existing content o Degrade gracefully o Do not reinvent the wheel o Pave the cowpaths o Evolution not revolution  Utility: o Separation of concerns o DOM consistency  Interoperability o Well defined behavior o Avoid needless complexity o Handles errors
  • 5.  Modernizr is an open source, MIT-licensed JavaScript library that detects support for many HTML5 & CSS3 features.  Creates a global object called Modernizr if (Modernizr.canvas) { // let's draw some shapes! } else { // no native canvas support available :( }
  • 6.  <section> is a sematic grouping of content, typically with a heading. o Web site's home page introduction, news items, contact information.  <nav> is a section of a page that links to other pages or to parts within the page  <article> represents a component of a page that consists of a self-contained composition o a forum post, a magazine or newspaper article, a Web log entry, a user-submitted comment, an interactive widget or gadget  <aside> Used for advertising, for groups of nav elements, and for other content that is considered separate from the main content of the page.
  • 7.  <section id="main"> o <article> <!-- first blog post content goes here --> </article> o <article> <!-- second blog post content goes here --> o </article> <article> <!-- third blog post content goes here --> </article>  </section>
  • 8.  <article> o <section id="introduction"> </section> o <section id="content"> </section> o <section id="summary"> </section>  </article>
  • 9.  <time> represents either a time on a 24 hour clock, or a precise date  <mark> represents text marked or highlighted  <figure> and <figcaption> represent an image, chart or code examples o <figure> o <img src="path/to/image" alt="About image" /> o <figcaption> o <p>This is an image of something interesting. </p> o </figcaption> o </figure>
  • 10.  <hgroup> to group a set of h1–h6 elements when the heading has multiple levels.  <header> contain the section’s heading (an h1–h6 element or an hgroup element) or section’s table of contents, a search form, or any relevant logos.  <footer> represents a footer for a sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.
  • 11. <header> <hgroup> <h1>My Weblog</h1> <h2>A lot of effort went into making this effortless.</h2> </hgroup> <nav> <ul> <li><a href="../semantics.html">home</a></li> <li><a href="../semantics.html">blog</a></li> <li><a href="../semantics.html">gallery</a></li> <li><a href="../semantics.html">about</a></li> </ul> </nav> </header>
  • 12. <header> <hgroup> <h1>My Weblog</h1> <h2>A lot of effort went into making this effortless.</h2> </hgroup> <nav> <ul> <li><a href="../semantics.html">home</a></li> <li><a href="../semantics.html">blog</a></li> <li><a href="../semantics.html">gallery</a></li> <li><a href="../semantics.html">about</a></li> </ul> </nav> </header>
  • 13. <article> <header> <time datetime="2009-10-22" pubdate>October 22, 2009</time> <h1> <a href="../semantics.html" title="link to this post">Travel day</a> </h1> </header> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec hendrerit felis accumsan turpis pretium tempor. Duis eu turpis nunc, ut euismod nisl. Aliquam erat volutpat. Proin eu eros mollis dui fringilla sodales. Curabitur venenatis tincidunt felis ac congue. Maecenas at odio dui, sit amet congue sapien. </p > </article>
  • 14. <input list="browsers"> <datalist id="browsers"> <option value="Others"> <option value="Internet Explorer"> <option value="Firefox"> <option value="Chrome"> <option value="Chrome Mobile"> <option value="Opera"> <option value="Safari"> </datalist>
  • 17.  email  contain an e-mail address, the e-mail address will be automatically validated when submitted.  month  to select a month and year, a date picker will show up in the input field.  number  contain a numeric value. o .max Specifies the maximum value for an input field o .min Specifies the minimum value for an input field o .pattern Specifies a regular exp to check the input value against o .step Specifies the legal number intervals for an input field o .stepUp(n) increases the field’s value by n. o .stepDown(n) decreases the field’s value by n. o .valueAsNumber returns the current value as a floating point number. o <input type="number" name="points" min="0" max="100" step ="10" value="30">
  • 18.  range  contain a value within a range, the input field will be displayed as a slider control. The default values from 0 to 100  <input type="range" name="points" min="0" max="10">  Some useful attributes: min, max, step.  search  search fields (behaves like a regular text field). Except that when you start typing in it a small cross appears on the right side of the field. This helps clear the content fast.  time  to select a time , a time picker can show up in the input field.  url  contain a URL address, the url field will be automatically validated when submitted  week  to select a week and year, a date picker will show up in the input field.``
  • 19.  New graphic elements: o <svg> and <canvas>.  New multimedia elements: o <audio> and <video>.
  • 20.  <video src="url/video.ogg" controls> o Your browser does not support the <code>video</code> element.  </video>  <audio src="/test/audio.ogg"> o <p>Your browser does not support the audio element.</p>  </audio>
  • 21.  Multiple Sources  <video width="320" height="240" controls autoplay loop > o <source src="movie.mp4" type="video/mp4”> o <source src="movie.ogg" type="video/ogg"> o Your browser does not support the video tag.  </video>
  • 22.  video/audio element methods: o canPlayType() Checks if the browser can play the specified audio/video type o load() Re-loads the audio/video element o play() Starts playing the audio/video o pause() Pauses the currently playing audio/video
  • 23.  video/audio element properties o autoplay Sets/Gets whether the audio/video should start playing when loaded o buffered Gets a TimeRanges of the buffered parts of the audio/video o controls Sets/Gets whether the audio/video display controls o currentSrc Gets the URL of the current audio/video o currentTime Sets/Gets the current playback position (in seconds) o defaultMuted Sets/Gets whether the audio/video should be muted by default o defaultPlaybackRate Sets/Gets the default speed of the audio/video playback o duration Gets the length of the current audio/video (in seconds) o ended Gets whether the playback of the audio/video has ended or not o error Gets a MediaError object, the error state of the audio/video o loop Sets/Gets whether the audio/video automatically start over again o muted Sets/Gets whether the audio/video is muted or not o networkState Gets the current network state of the audio/video o paused Gets whether the audio/video is paused or not o playbackRate Sets/Gets the speed of the audio/video playback o played Gets a TimeRanges object of the played parts of the audio/video o preload Sets/Gets whether audio/video is loaded on page load o readyState Gets the current ready state of the audio/video o seekable Gets a TimeRanges object, the seekable parts of the audio/video o seeking Gets whether the user is currently seeking in the audio/video o src Sets/Gets the current source of the audio/video element o startDate Gets a Date object representing the current time offset o volume Sets/Gets the volume of the audio/video
  • 24.  video/audio element events o abort Fires when the loading is aborted o canplay Fires when the browser can start playing o canplaythrough Fires when the browser can play without stopping for buffering o durationchange Fires when the duration is changed (after it is loaded) o ended Fires when the audio/video has ended o error Fires when an error occurred during loading o loadeddata Fires when the browser has loaded the current frame o loadedmetadata Fires when the browser has loaded meta data o loadstart Fires when the browser starts looking for the audio/video o pause Fires when been paused o play Fires when started or is not paused o playing Fires when playing after being paused or stopped for buffering o progress Fires when downloading the audio/video o ratechange Fires when the playing speed is changed o seeked Fires when the user finish moving/skipping to a new position o seeking Fires when the user starts moving/skipping to a new position o stalled Fires when browser is trying to get media data, but data is N/A o suspend Fires when the browser is intentionally not getting media data o timeupdate Fires when the current playback position has changed o volumechange Fires when the volume has been changed o waiting Fires when the video stops to buffer the next frame
  • 25.  loadstart  o durationchange  • loadedmetadata  • loadeddata  • progress  • canplay  • canplaythrough
  • 26.  Canvas: “a strong, coarse unbleached cloth used to make items such as sails and tents and as a surface for oil painting.”  Used to: o draw graphics, o make photo compositions, real-time video processing or rendering. o create animations  The default size of the canvas is 300 px × 150 px (width × height). o <canvas id="c1"></canvas> o <script> o var canvas = document.getElementById("c1"); o var ctx = canvas.getContext("2d"); o ctx.fillStyle = "green"; o ctx.fillRect(10, 10, 100, 100); o </script>
  • 27.  Color o ctx.fillStyle = "green"; o ctx.strokeStyle = "green”; o fillStyle and strokeStyle sets the colors used for rendering filled/framed shapes o Can use gradient object or a pattern  To clear canvas: o ctx.clearRect(x,y,width,height); How to creates a gradients or a pattern?
  • 28.  Line: o to move to the starting point, Set the endpoint, o Draw a line between them • ctx.moveTo(60,0); • ctx.lineTo(60,153); • ctx.stroke();  You can set multiple line to be drawn at once instead using path o ctx.beginPath(); o ctx.strokeStyle="red"; o ctx.moveTo(60,173); o ctx.lineTo(60,375); o ctx.moveTo(60,390); o ctx.lineTo(270,390); o ctx.moveTo(270,375); o ctx.lineTo(270,173); o ctx.stroke(); o ctx.closePath();
  • 29.  Rectangle o ctx.fillRect(10, 10, 100, 100); // x, y, width, height o ctx.strokeRect(10,10,100,100) // only edges , no fill o ctx.clearRect(10,10,100,100) // clear part of the canvas rep. by the rect  Arc/Circles o ctx.arc(x,y,radius,startAngle,endAngle,anticlockwise)  Text o ctx.font=”bold 12px sans-serif”; // CSS font rule o ctx.textAlign=”center”; //start, end, left, right, center o ctx.fillText(“str”,x,y); // print str as a text starting from x and y
  • 30.  Read more on Bezier and quadratic curves in o https://developer.mozilla.org/en- US/docs/web/api/canvas_api/tutorial/drawing_shapes#Bezier_an d_quadratic_curves
  • 31.  Scalable Vector Graphics o Describes 2D graphics in XML o Ideal for handling different screen sizes o Resolution independent  <svg id=“svgelem” height=“200” xmlns=“”> o <circle id=“redcircle” cx=“50” cy=“50” r=“50” fill=“red” />  </svg> http://www.w3.org/TR/SVG/
  • 33.  navigator.geolocation object  Getting the current position o getCurrentPosition( sucesscallback, errorcallback, geo_options) o navigator.geolocation.getCurrentPosition(function(position) { alert(position.coords.latitude+”-”+position.coords.longitude); });  Watching the current position o watchPosition(successcallback, errorcallback, geo_options)  PositionOptions Object o var geo_options = { o enableHighAccuracy: true, o maximumAge : 30000, o timeout : 27000 o };
  • 34.  Steps: o Define a draggable target using draggable attribute o Define data to be dragged (ondragstart) • Text, Links, HTML and XML • Files, Images • Document Nodes o Define custom drag feedback image o Define drag effect • copy, move, link o Define Drop area o Do something when drop occurs http://html5demos.com/drag
  • 35.  Drag Events o dragstart o dragenter o dragover o dragleave o drag o drop o dragend
  • 36.  Default drag behaviour o text selection o Images o links  To make other elements draggable o Set draggable=true o Add a listener for the dragstart events o Set drag data within the listener defined above  <div draggable="true" ondragstart="event.dataTransfer.setData('text/plain', 'This text may be dragged')”> o This text <strong>may</strong> be dragged.  </div>
  • 37.  dragstart event used to: o Specify drag data • Drag event has property dataTransfer contains format and value o Feedback image o Drag effect
  • 38.  dragenter/dragover event for drop target elements o Can be used to check whether drop is allowed to be dropped by checking dataTransfer data type/format
  • 39.  dragstart event used to: o Specify drag data • Drag event has property dataTransfer contains format and value o Feedback image o Drag effect
  • 40.  Dropping o Handle Drop event • Prevent browser default behavior (redirection)
  • 41.
  • 42.  First there were cookies o Included in each request o Max 4KB o Can be turned off  HTML5 Web Storage: o Local Storage o Session Storage
  • 43.  Persist data for the duration of the page session. o As long as browser is open, survive reloads o New tab/ new window  new session  Add/edit/delete the sessionStorage object  Saved in a key/value pair o sessionStorage.setItem(‘name’,’John’); Or sessionStorage.name=‘John’ o var item=sessionStorage.getItem(‘name’); o sessionStorage.removeItem(‘name’); o sessionStorage.clear();
  • 44.  Persist data until history cleared  Add/edit/delete the localStorage object  Saved in a key/value pair o localStorage.setItem(‘name’,’John’); Or localStorage.name=‘John’ o var item=localStorage.getItem(‘name’); o localStorage.removeItem(‘name’); o localStorage.clear();
  • 45.  Serialize them into JSON string then save them o JSON.stringify(jsobject)  json string  When retrieving deserialize the JSON string into an object o JSON.parse(jsonstr)  javascript object
  • 46.  What is HTML 5 Microdata?  What is Web Worker API?  What is Application Cache?  What is IndexedDB?

Editor's Notes

  1. Pave the cowpaths, that is if something is working well and solving problems, use it by all means. Evolution not revolution, if users are accustomed to something, don’t break that experience
  2. All are block elements Semantic  related to meaning. <div> and <span> have no meaning, tells nothing about their content. <header>, <nav>, and <img> are meaningful, they clearly define their content.
  3. The canvas can be sized arbitrarily by CSS, but during rendering the image is scaled to fit its layout size: if the CSS sizing doesn't respect the ratio of the initial canvas, it will appear distorted.  Note: If your renderings seem distorted, try specifying your width and height attributes explicitly in the <canvas> attributes, and not using CSS.
  4. When drawing multiple lines, it's more efficient to create one path with all the lines in it and draw it with a single draw call.
  5. var ctx = canvas.getContext('2d'); ctx.arc(75,75,50,0,Math.PI*2,true); // Outer circle ctx.stroke();
  6. var ctx = canvas.getContext('2d'); ctx.arc(75,75,50,0,Math.PI*2,true); // Outer circle ctx.stroke();