html5 and css3 – exploring mobile possibilities - dynabyte event

63
HTML5 and CSS3: Exploring Mobile Possibilities HTML5 and CSS3: Exploring Mobile Possibilities

Upload: robert-nyman

Post on 27-Jan-2015

109 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

HTML5 and CSS3: Exploring Mobile Possibilities

HTML5 and CSS3: Exploring Mobile Possibilities

Page 2: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
Page 3: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
Page 5: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

widthheightdevice-widthdevice-heightorientationaspect-ratiodevice-aspect-ratio

colorcolor-indexmonochromeresolutionscangrid

Page 6: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

min-widthmax-widthorientation

Page 7: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

<link rel="stylesheet" href="pretty.css" media="screen and (min-width: 500px)">

Page 8: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

.nav { width: 150px;}

@media screen and (min-width: 500px) { .nav { width: 300px; }}

Page 9: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

@media screen and (min-width: 500px) and (max-width: 1024px) { .nav { width: 200px; }}

Page 10: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

@media screen and (min-width: 100px),@media handheld { .nav { width: 350px; }}

Page 11: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

@media only screen and (min-width: 100px) { .nav { width: 350px; }}

Page 12: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

@media not screen and (min-width: 100px) { .nav { width: 100%; }}

Page 13: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

@media screen and (orientation: landscape) { .nav { float: left; width: 20%; } .main { float: right; width: 80%; }}

Page 14: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

@media screen and (orientation: portrait) { .nav { width: 100%; } .main { width: 100%; }}

Page 15: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

<meta name="viewport" content="width=device-width, maximum-scale=1.0">

Page 19: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

<div class="flex-container"> <section class="col-1">I am column 1</section> <section class="col-2">I am column 2</section> <section class="col-3">I am column 3</section></div>

Page 20: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

.flex-container { display: -moz-box; display: -ms-box; display: -webkit-box; display: box; -moz-box-orient: horizontal; -ms-box-orient: horizontal; -webkit-box-orient: horizontal; box-orient: horizontal;}

Page 21: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

.col-1 { -moz-box-flex: 1; -ms-box-flex: 1; -webkit-box-flex: 1; box-flex: 1;}

.col-2 { -moz-box-flex: 1; -ms-box-flex: 1; -webkit-box-flex: 1; box-flex: 1;}

.col-3 { -moz-box-flex: 2; -ms-box-flex: 2; -webkit-box-flex: 2; box-flex: 2;}

Page 22: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

.col-1 { -moz-box-ordinal-group: 2; -ms-box-ordinal-group: 2; -webkit-box-ordinal-group: 2; box-ordinal-group: 2;}

.col-2 { -moz-box-ordinal-group: 3; -ms-box-ordinal-group: 3; -webkit-box-ordinal-group: 3; box-ordinal-group: 3;}

.col-3 { -moz-box-ordinal-group: 1; -ms-box-ordinal-group: 1; -webkit-box-ordinal-group: 1; box-ordinal-group: 1;}

Page 23: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

flex- instead of box-

Page 25: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

/* Shorthand version */#hello { display: inline-block; height: 20px; opacity: 0.3; -moz-transition: height 1s ease-out, opacity 1s ease; -ms-transition: height 1s ease-out, opacity 1s ease; -o-transition: height 1s ease-out, opacity 1s ease; -webkit-transition: height 1s ease-out, opacity 1s ease; transition: height 1s ease-out, opacity 1s ease;}

#hello:hover { height: 40px; opacity: 1;}

Page 26: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

/* Shorthand version */.menu-item { position: relative; display: inline-block; border: 1px dashed #000; padding: 10px; background: #ffffa2; height: 20px; opacity: 0.3; text-decoration: none; -moz-transition: all 1s ease; -ms-transition: all 1s ease; -o-transition: all 1s ease; -webkit-transition: all 1s ease; transition: all 1s ease;}

.menu-item:hover { opacity: 1; -moz-transform: scale(2) rotate(30deg) translate(50px); -ms-transform: scale(2) rotate(30deg) translate(50px); -o-transform: scale(2) rotate(30deg) translate(50px); -webkit-transform: scale(1.2) rotate(30deg) translate(50px); transform: scale(2) rotate(30deg) translate(50px);}

Page 28: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

.love-me { -webkit-transform: translate3d(0, 0, 0);}

Page 30: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

.animation-container { height: 60px; padding: 10px; -moz-animation-name: movearound; -moz-animation-duration: 4s; -moz-animation-iteration-count: infinite; -moz-animation-direction: normal; -moz-animation-timing-function: ease; -webkit-animation-name: movearound; -webkit-animation-duration: 4s; -webkit-animation-iteration-count: infinite; -webkit-animation-direction: normal; -webkit-animation-timing-function: ease;}

@-moz-keyframes movearound { from { width: 200px; background: #f00; opacity: 0.5; -moz-transform: scale(0.5) rotate(15deg); } to { width: 400px; background: #ffffa2; opacity: 1; -moz-transform: scale(1) rotate(0deg); }}

Page 31: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

@-webkit-keyframes movearound { from { width: 200px; background: #f00; opacity: 0.5; -webkit-transform: scale(0.5) rotate(15deg); } to { width: 400px; background: #ffffa2; opacity: 1; -webkit-transform: scale(1) rotate(0deg); }}

Page 44: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

Link protocols

Page 45: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

<a href="tel:+441111234567">tel: link</a>

<a href="sms:+441111234567">sms: link</a>

<a href="sms:+441111234567?body=Text%20me"> sms: with body</a>

<a href="sms:+441111234567,+441111678901"> sms: with multiple numbers</a>

<a href="sms:+441111234567,+441111678901?body=Text%20me"> sms: with multiple numbers + body</a>

Page 46: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

#browserlove

Page 48: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (position) { alert(position.coords.latitude + ", " + position.coords.longitude); }); }

Page 49: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
Page 50: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
Page 52: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

// Poll the navigator.onLine propertysetInterval(function () { console.log(navigator.onLine);}, 1000);

Page 53: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

<!DOCTYPE html><html manifest="offline.appcache"><head>...

Page 54: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

CACHE MANIFEST

# VERSION 10

CACHE:offline.htmlbase.css

FALLBACK:online.css offline.css

NETWORK:/live-updates

Page 55: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
Page 60: HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event

position: fixed

overflow: scroll

-webkit-overflow-scrolling: touch

Web Workers