1. KARKHA.COM
WELCOME TO HTML 5 AND CSS 3 WORKSHOP
BY
KAMALAKANNAN . S
9789989552
https://www.facebook.com/sivkannan
@sivkannan77
Sundaresan - 9941131357
Chockalingam - 9543111174
09/09/12 Www.karkha.com 1
2. KARKHA.COM
● We Karkha.com is young and vibrant open source web
development startup. We rollout by January 2013.
● What we plan to do next four months
●Initially we conduct workshops
● Weekend courses on open source
● Goals
● To bridge the gap between industry required open source technical
skills
● Provide solutions and services for web and mobile application.
09/09/12 Www.karkha.com 2
3. What is HTML5?
“HMTL5 is not a single thing or a monolithic
technology. It is a collection of features,
technologies, and APIs that brings the power of
the desktop and the vibrancy of multimedia
experience to the web—while amplifying the web’s
core strengths of interactivity and connectivity.”
- www.HTML5ROCKS.com
HTML5 = fifth revision of HTML + CSS3 + JS
09/09/12 Www.karkha.com 3
4. HTML 5
● Can i start using HTML5 ?
● Do i need to relearn HTML 4 already i am
familiar with
● How to updgrade from HTML 4
09/09/12 Www.karkha.com 4
5. HTML 5 features
● Offline / storage
● Realtime / communication
● File / Hardware Access
● Semantics & Markup
● Audio & Video
● 3D Graphics
● Presentation ( CSS3 )
09/09/12 Www.karkha.com 5
14. New HTML 5 Elements
How older browser understand new elements defined by HTML 5
All browsers render unknown elements inline, i.e. as if they had a display:inline
CSS rule.
article,aside,details,figcaption,figure,
footer,header,hgroup,menu,nav,section {
display:block;
}
http://www.html5doctor.com/html-5-reset-stylesheet/
09/09/12 Www.karkha.com 14
15. New HTML 5 Elements
Internet explorer < 9 will not apply any style to unknown
elements
Internet explorer will insert the unknown elements as
empty node in dom
Children's of unknown elements will be treated as siblings
in Dom tree
http://remysharp.com/2009/01/07/html5-enabling-script/
09/09/12 Www.karkha.com 15
16. HEADER
<header>
<hgroup>
<h1>My header</h1>
<p class="tagline">A tagline for this header.</p>
</hgroup>
…
</header>
09/09/12 Www.karkha.com 16
17. Article
<article>
<header>
<h1>A heading for this post or article</h1>
</header>
<p>Lorem ipsum..</p>
</article>
09/09/12 Www.karkha.com 17
18. Dates and Times
<time datetime="2009-10-22" pubdate>October 22, 2009</time>
There are three parts to a <time> element:
● A machine-readable timestamp
● Human-readable text content
● An optional pubdate flag
datetime="2009-10-22T13:59:47-04:00"
09/09/12 Www.karkha.com 18
20. Section and aside
<section>
...
</section>
The section element represents a generic section of a document or application. A section,
in this context, is a thematic grouping of content, typically with a heading.
<aside>
...
</aside>
The aside element represents a section of a page that consists of content that is
tangentially related to the content around the aside element, and which could be
considered separate from that content. Such sections are often represented as sidebars in
printed typography.
09/09/12 Www.karkha.com 20
22. Footer
The HTML5 specification says, “A footer typically
contains information about its section such as who
wrote it, links to related documents, copyright data,
and the like.”
<footer>
....
</footer>
09/09/12 Www.karkha.com 22
23. Placeholder Text
<form>
<input name="search" placeholder="Search with
keyword">
<input type="submit" value="Search">
</form>
09/09/12 Www.karkha.com 23
24. Auto focus
<form>
<input name="search" placeholder="Search with
keyword" autofocus>
<input type="submit" value="Search">
</form>
09/09/12 Www.karkha.com 24
25. HTML form elements
Field Type HTML Code Notes
checkbox <input type="checkbox"> can be toggled on or off
radio button <input type="radio"> can be grouped with other
inputs
password field <input type="password"> echos dots instead of
characters as you type
drop-down lists <select><option>…
file picker <input type="file"> pops up an “open file” dialog
submit button <input type="submit">
plain text <input type="text"> the type attribute can be
omitted
09/09/12 Www.karkha.com 25
28. Microdata
The HTML5 microdata is a way to label content to
describe a specific type of information—for example,
reviews, person information, or events. Each information
type describes a specific type of item, such as a person,
and event, or a review. For example, an event has the
properties venue, starting time, name, and category.
Microdata uses simple attributes in HTML tags (often
<span> or <div>) to assign brief and descriptive names to
items and properties.
09/09/12 Www.karkha.com 28
29. Microdata
Without Microdate an HTML source
<div>
My name is Bob Smith but people call me Smithy. Here is my home page:
<a href="http://www.example.com">www.example.com</a>
I live in Albuquerque, NM and work as an engineer at ACME Corp.
</div>
09/09/12 Www.karkha.com 29
30. Microdata
With Microdate an HTML source
<div itemscope itemtype="http://data-vocabulary.org/Person">
My name is <span itemprop="name">Bob Smith</span>
but people call me <span itemprop="nickname">Smithy</span>.
Here is my home page:
<a href="http://www.example.com" itemprop="url">www.example.com</a>
I live in Albuquerque, NM and work as an <span
itemprop="title">engineer</span>
at <span itemprop="affiliation">ACME Corp</span>.
</div>
09/09/12 Www.karkha.com 30
31. Microdata
In the first line, itemscope indicates that the content in the <div> is an
item. itemtype="http://data-vocabulary.org/Person indicates that the item is
a Person.
Each property of the Person item is identified with the itemprop attribute.
For example, itemprop="name" describes the person's name.
Rich Snippets Testing Tools
http://www.google.com/webmasters/tools/richsnippets
Check that Google can correctly parse your structured data markup and
display it in search results.
09/09/12 Www.karkha.com 31
34. Presentation
● Background-image mulitple images
#exampleA {
width: 500px;
height: 250px;
background-image: url(decoration.png),
url(ribbon.png), url(old_paper.jpg);
background-repeat: no-repeat;
background-position: left top, right
bottom, left top;
}
09/09/12 Www.karkha.com 34
35. Presentation
RGBA (red green blue opacity)
Red, Green and Blue values between 0 and 255
Opacity or alpha value between 0 and 1
Example : background-color: rgba(215, 44, 44, 0.5);
Difference between Opacity and rgba is Opacity sets opacity
value to the element and its children. Whereas RGBA is alpha
or opacity applied to the color of the element, without affecting
the childrens.
09/09/12 Www.karkha.com 35
36. Presentation
text-shadow: 2px 2px
2px #000;
This produces the
following text with a
shadow 2px right and
below of the text, which
blurs for 2px:
09/09/12 Www.karkha.com 36
37. Presentation
Box-sizing decides the width of the box
whether to include the padding and border .
Content-box will not include the padding
and boder in width
Border-box will include the padding and
border in width
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
09/09/12 Www.karkha.com 37
38. Presentation
Resize allow element to resize,
normally using js we provide this to
textarea in our sites. Now css3 has
property to resize a element.
div.resize {
width: 100px;
height: 100px;
border: 1px solid;
resize: both;
overflow: auto;
}
09/09/12 Www.karkha.com 38
39. Presentation
Substring Matching Attribute Selectors
[att^=val] – the “begins with” selector
[att$=val] – the “ends with” selector
[att*=val] – the “contains” selector
Example
http://www.css3.info/preview/attribute-selectors/
http://www.456bereastreet.com/archive/200601/css_3_selectors_explained/
09/09/12 Www.karkha.com 39
41. Presentation
Media Queries
@media screen {
* { font-family: sans-serif }
}
@media screen and (min-width: 400px) and (max-width: 700px) { … }
This media query expresses that the style sheet is usable on devices
with viewport (the part of the screen/paper where the document is
rendered) widths between 400 and 700 pixels:
09/09/12 Www.karkha.com 41
42. Presentation
Media Queries
This media query expresses that style sheet is usable on
screen and handheld devices if the width of the viewport is
greater than 20em.
@media handheld and (min-width: 20em),
screen and (min-width: 20em) { … }
The ‘em’ value is relative to the initial value of ‘font-size’.
09/09/12 Www.karkha.com 42
45. Presentation
CSS3 Transitions are a presentational effect which allow
property changes in CSS values, such as those that may
be defined to occur on :hover or :focus, to occur smoothly
over a specified duration – rather than happening
instantaneously as is the normal behaviour.
Transition effects can be applied to a wide variety of CSS
properties, including background-color, width, height,
opacity, and many more. Keep reading for further details of
supported properties.
09/09/12 Www.karkha.com 45
That happens to be one of the 15 doctypes that trigger “standards mode” in all modern browsers. There is nothing wrong with it. If you like it, you can keep it. Or you can change it to the HTML5 doctype, which is shorter and sweeter and also triggers “standards mode” in all modern browsers. That’s it. Just 15 characters. It’s so easy, you can type it by hand and not screw it up.
There is nothing wrong with this markup. Again, if you like it, you can keep it. It is valid HTML5. But parts of it are no longer necessary in HTML5, so you can save a few bytes by removing them.
Regular links (<a href>) simply point to another page. Link relations are a way to explain why you’re pointing to another page. They finish the sentence “I’m pointing to this other page because...” ...it’s a stylesheet containing CSS rules that your browser should apply to this document. ...it’s a feed that contains the same content as this page, but in a standard subscribable format. ...it’s a translation of this page into another language. ...it’s the same content as this page, but in PDF format. ...it’s the next chapter of an online book of which this page is also a par
This link relation is also quite common. <link rel="alternate">, combined with either the RSS or Atom media type in the type attribute, enables something called “feed autodiscovery.” It allows syndicated feed readers (like Google Reader) to discover that a site has a news feed of the latest articles. Some browsers also support feed autodiscovery by displaying a special icon next to the URL. (Unlike with rel="stylesheet", the type attribute matters here. Don’t drop it!)
Also new in HTML5: the sizes attribute can be used in conjunction with the icon relationship to indicate the size of the referenced icon.
HTML5 provides a solution for this: the <hgroup> element. The <hgroup> element acts as a wrapper for two or more related heading elements. What does “related” mean? It means that, taken together, they only create a single node in the document outline.
The article element represents a component of a page that consists of a self-contained composition in a document, page, application, or site and that is intended to be independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a Web log entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.
Dateandtime attribute can have only machine readable date or append T to 24 hour time format with timezone Pubdate specifies the article published date if it recides inside the article tag or the publication date of the entire document
This is more to define the Navigation for html page and differentiate from other list of links, more helpful for people with disabilities.
Web sites can use JavaScript to focus the first input field of a web form automatically. For example, the home page of Google.com will autofocus the input box so you can type your search keywords. While this is convenient for most people, it can be annoying for power users or people with special needs. If you press the space bar expecting to scroll the page, the page will not scroll because the focus is already in a form input field. (It types a space in the field instead of scrolling.) If you focus a different input field while the page is still loading, the site’s autofocus script may “helpfully” move the focus back to the original input field, disrupting your flow and causing you to type in the wrong place.
Web sites can use JavaScript to focus the first input field of a web form automatically. For example, the home page of Google.com will autofocus the input box so you can type your search keywords. While this is convenient for most people, it can be annoying for power users or people with special needs. If you press the space bar expecting to scroll the page, the page will not scroll because the focus is already in a form input field. (It types a space in the field instead of scrolling.) If you focus a different input field while the page is still loading, the site’s autofocus script may “helpfully” move the focus back to the original input field, disrupting your flow and causing you to type in the wrong place.
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier
To sum up: there’s no downside to converting all your email address form fields to type="email" immediately. Virtually no one will even notice, except iPhone users, who probably won’t notice either. But the ones who do notice will smile quietly and thank you for making their web experience just a little easier