Top Banner
Estelle Weyl http://standardista.com http://evotech.net/blog @estellevw CSS3: Si se pued http://findmebyip.com/litmus/
32

Open Web Camp: CSS3 Implementable Features

Dec 05, 2014

Download

Technology

Estelle Weyl

CSS3: You can use CSS3 selectors to target almost any item on the page without adding markup. Rounded corners, tilted images. Drop shadows. CSS3 is the latest and greatest and all the cool kids are doing it. But there is a lot of crazy syntax to memorize and what happens when all browsers are not capable of the effects you are after?

In this session we will learn which CSS3 selectors and design features are supported in modern browsers, and tips and tricks for handling browsers that aren't quite there yet. Welcome to the next generation of web design!
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Open Web Camp: CSS3 Implementable Features

Estelle Weylhttp://standardista.comhttp://evotech.net/blog

@estellevw

CSS3: Si se puede

htt

p:/

/findm

eb

yip

.com

/lit

mu

s/

Page 2: Open Web Camp: CSS3 Implementable Features

CSS2.1

Page 3: Open Web Camp: CSS3 Implementable Features

CSS3Unfinished, but well supported

Page 4: Open Web Camp: CSS3 Implementable Features

Graceful Degradation /Progressive Enhancement

Page 5: Open Web Camp: CSS3 Implementable Features

Don’t need to be identical

Page 6: Open Web Camp: CSS3 Implementable Features

Don’t need to be identical

Sites need to be usable and look as good as possible to as many people as

possible.

Page 7: Open Web Camp: CSS3 Implementable Features

Modernizr

<html class=“js canvas canvastext geolocation crosswindowmessaging no-websqldatabase no-indexeddb hashchange no-historymanagement draganddrop no-websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow opacity no-cssanimations csscolumns cssgradients no-cssreflections csstransforms no-csstransforms3d no-csstransitions video audio localstorage sessionstorage webworkers applicationcache svg no-smil svgclippaths input-multiple video-ogg audio-ogg audio-wav fontface”>

Page 8: Open Web Camp: CSS3 Implementable Features

Implementable Features CSS3 Selectors.

Text Shadow (2.0).

Box Shadow (prefixed)

Rounded Corners (prefixed).

@font-face

Alpha Transparency (hsla, rgba).

Opacity.

Rotation.

Page 9: Open Web Camp: CSS3 Implementable Features

Implementable Features Multiple background images

Text-overflow

Gradients

Transforms

Background size

Page 10: Open Web Camp: CSS3 Implementable Features

Implementable Features?

Multi-column layout

Animations

Transitions

Border-image

Reflections

Page 11: Open Web Camp: CSS3 Implementable Features

CSS3 Selectors

E[attribute] E[attribute=value] E[attribute~=value] E[attribute|=value] E[attribute^=value] E[attribute$=value] E[attribute*=value]:not([attribute])

Page 12: Open Web Camp: CSS3 Implementable Features

CSS3 Selectors

:last-child:only-child :nth-child() :nth-last-child():first-of-type :last-of-type :only-of-type :nth-of-type()

:nth-last-of-type():empty :not() :target :enabled:disabled:checked

http://www.standardista.com/css3/css3-selector-browser-support

Page 13: Open Web Camp: CSS3 Implementable Features

CSS3 Selectors

:nth-of-type()

tr:nth-of-type(even) td{ background-color: #dedede;}http://www.standardista.com/sandbox/nthoftype.html

Page 14: Open Web Camp: CSS3 Implementable Features

CSS3 Selectors

:nth-of-type()

$(‘tr:nth-of-type(even)’).addClass(‘evenrow’)

tr:nth-of-type(even) td, tr.evenrow td{ background-color: #dedede;}

+ jQuery

Page 15: Open Web Camp: CSS3 Implementable Features

CSS3 Selectors Hack

selector:nth-of-type(n) { /* hide from IE */}

Page 16: Open Web Camp: CSS3 Implementable Features

Alpha Tranparency

rbga( red, green, blue, opacity);

.blackfilter{ background-color: rgba(0, 0, 0, 0.4);}

http://www.standardista.com/articles/rgba.html

Page 17: Open Web Camp: CSS3 Implementable Features

Alpha Tranparency

.blackfilter{ background:transparent; filter:progid:DXImageTransform.Microsoft.gradient( startColorstr=#99000000,endColorstr=#99000000);

zoom: 1; background-color: rgba(0,0,0,0.4);}

Page 18: Open Web Camp: CSS3 Implementable Features

Opacity

Doesn’t have the impact you intended

.halfthere { opacity: 0.4;}

http://www.standardista.com/articles/rgba_notopacity.html

Page 19: Open Web Camp: CSS3 Implementable Features

Opacity

Doesn’t have the impact you intended

.halfthere { opacity: 0.4; filter: alpha(opacity=0.4)}

http://www.standardista.com/articles/rgba_notopacity.html

Page 20: Open Web Camp: CSS3 Implementable Features

Opacity

Doesn’t have the impact you intended

.halfthere { opacity: 0.4; filter: alpha(opacity=0.4)}

Coming in Opera 10

http://www.standardista.com/articles/rgba_notopacity.html

Page 21: Open Web Camp: CSS3 Implementable Features

HSL(A)

Hue, saturation, lightness, alpha-transparency

http://www.standardista.com/sandbox/hsl.php

http://www.standardista.com/sandbox/hsl360.php

Page 22: Open Web Camp: CSS3 Implementable Features

Rounded Corners

.rounded { -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px;}

Order: topleft, topright, bottomright, bottomleft.

Page 23: Open Web Camp: CSS3 Implementable Features

Rounded Corners

.rounded { -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; position: relative;}

$(‘.rounded’).append(‘<b class=“tr”></b> <b class=“tl”></b><b class=“br”></b> <b class=“bl”></b>’);

Page 24: Open Web Camp: CSS3 Implementable Features

Text Shadow .shadowed {

text-shadow: 3px 3px 3px rgba(0,0,0,0.4);}

leftOffset rightOffset blur Color

Page 25: Open Web Camp: CSS3 Implementable Features

Box Shadow -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.4),

inset -5px -24px 24px rgba(255, 206, 168, 0.6);

-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.4),

inset -5px -24px 24px rgba(255, 206, 168, 0.6);

box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.4), inset -5px -24px 24px rgba(255,

206, 168, 0.6); /* Opera 10.5, IE 9.0 */

Page 26: Open Web Camp: CSS3 Implementable Features

Box Shadow -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.4),

inset -5px -24px 24px rgba(255, 206, 168, 0.6);

-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.4),

inset -5px -24px 24px rgba(255, 206, 168, 0.6);

box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.4), inset -5px -24px 24px rgba(255,

206, 168, 0.6); /* Opera 10.5, IE 9.0 */

filter: Shadow(Color=#000000,Direction=220,Strength=8);

Page 27: Open Web Camp: CSS3 Implementable Features

Text Shadow Cut out text

.shadowed { color: #CCCCCC; text-shadow: 3px 3px 3px rgba(0,0,0,0.4); color: rgba(255,255,255,1)}

http://www.standardista.com/articles/text_shadow.html

Page 28: Open Web Camp: CSS3 Implementable Features

Rotation

-webkit-transform: rotate(90deg);

-moz-transform: rotate(90deg);

-o-transform: rotate(90deg);

transform: rotate(90deg);

filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);

1=90, 2=180, 3=270

http://standardista.com/sandbox/rotation.html

Page 29: Open Web Camp: CSS3 Implementable Features

Rotation

-webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -o-transform: rotate(90deg);transform: rotate(90deg);

filter: progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', M11=0.9961946980917455, M12=0.08715574274765817, M21=-0.08715574274765817, M22=0.9961946980917455);

-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand', M11=0.9961946980917455, M12=0.08715574274765817, M21=-0.08715574274765817, M22=0.9961946980917455)";

http://css3please.com/

Page 30: Open Web Camp: CSS3 Implementable Features

Gradients.

background-image:url(svgsprite.svg); /* because opera doesn't yet support gradients */

background-image: -moz-linear-gradient(-90deg, #FFCCCC, #E71616 50%, #D40009);

background-image: -webkit-gradient(linear, 0 top, 0 bottom, from(#FFCCCC), color-stop(50%, #E71616), to(#D40009));

http://standardista.com/sandbox/opera_logo.html

Page 31: Open Web Camp: CSS3 Implementable Features

Thanks.

Estelle Weyl

Twitter: @estellevw

Blog: http://www.standardista.com

http://evotech.net/blog

Page 32: Open Web Camp: CSS3 Implementable Features

Prizes

Ticket the FrontEndDesign Conference

Ticket to CSSSummit (online)

Copy of my Book - Beginning iPhone Web Apps: HTML5, CSS3, and JavaScript for WebKithttp://apress.com/book/view/9781430230069