SlideShare a Scribd company logo
CSS3: the new style
     council
   Chris Mills, Opera Software




            Slides available on http://slideshare.net/chrisdavidmills
http://www.flickr.com/photos/attackcat/5172855379/
Who the hell am I?
‣ Opera open standards evangelist and tech writer
‣ Telling the world about open standards & Opera
‣ Improving web education
‣ Moaning
‣ Drinking beer & saving the world before morning
‣ Drumming in a heavy metal band
CSS3!



 http://www.flickr.com/photos/burningmax/4956554644/
What is CSS3?
‣ A series of new modules
‣ Add extra functionality on top of CSS2.1
‣ Lets us do things more quickly and easily
Sounds good!
‣ Less time spent in Photoshop
‣ Less time spent with JavaScript
‣ Less time spent maintaining sites
‣ More time spent in the pub
Modular = good
‣ Browser vendors can work on one module at a
  time
‣ Less worry and pressure about supporting the
  entire spec
When should I use it?
I’d argue “now”
‣ Most browsers support most of this stuff now
‣ Most of it degrades gracefully
‣ And you can work around problems
‣ Depends on what your client needs
‣ By “identical”, how similar do you mean??
Try to argue the case...
...”identical in every browser” is outdated
‣ Especially with mobile phones, iPad, tablets...
‣ And IE6 is a decade old now
‣ Surely providing an acceptable experience in
   each browser is, well, acceptable?
‣ Then you can spend more less time on hacking
Modernizr
Using modernizr
<html
class="no‐js">










+
<script
src="modernizr‐1.6.min.js"></script>

















=
<html
class="js
no‐flexbox
canvas
canvastext
no‐
webgl
no‐touch
geolocation
postmessage

websqldatabase
no‐indexeddb
hashchange
no‐history

no‐draganddrop
no‐websockets
rgba
hsla
multiplebgs

backgroundsize
borderimage
borderradius
boxshadow

textshadow
opacity
no‐cssanimations
...
>
Using modernizr
.no‐cssanimations
#animated‐menu
{


...
}
Drop shadows
text‐shadow:
black
3px
3px
5px;

text‐shadow:
0
0
4px
white,













0
‐5px
4px
#ffff33,













2px
‐10px
6px
#ffdd33,













‐2px
‐15px
11px
#ff8800,













2px
‐25px
18px
#ff2200,
Drop shadows
box‐shadow:
4px
4px
5px
black;
‐webkit‐box‐shadow:
4px
4px
5px
black;
Drop shadows
Inset:
box‐shadow:
inset
‐4px
‐4px
10px
black;

Spread:
box‐shadow:
4px
4px
5px
6px
black;
Opacity
background‐color:
rgb(204,204,204);
border:
1px
solid
black;
opacity:
0.6;
RGB(a)
background‐color:
rgba(204,204,204,0.6);
HSL(a)
#p1
{
background‐color:
hsla(0,100%,50%,1);
}

#p2
{
background‐color:
hsla(0,100%,60%,1);
}

#p3
{
background‐color:
hsla(0,100%,70%,1);
}

#p4
{
background‐color:
hsla(0,100%,80%,1);
}
border-radius
Finally — web 2.0 is easy!
border‐radius:
10px;

border‐radius:
0px
0px
10px
0px;
Transitions
Offer animation-like abilities
‣ Set a default state for the element
‣ Choose property to transition, and duration
‣ Then set state to transition to
Transition default state
#links
a,
#links
a:link
{


color:
black;


font‐size:
1.2em;


padding:
0.5em;


display:
block;


text‐decoration:
none;


background‐color:
rgb(255,255,255);


transition‐property:
background‐color;


transition‐duration:
1s;
Transitioned state
#links
a:hover,
#links
a:active

{


background‐color:
rgb(150,150,150);
}
Transitions: easing
Controlling the pattern of acceleration/
deceleration, for a more natural feel
transition‐timing‐function:
ease‐in;
transition‐timing‐function:
ease‐out;
transition‐timing‐function:
ease‐in‐out;
transition‐timing‐function:
ease‐out‐in;
transition‐timing‐function:
linear;
Transitions: delay
Add a delay before the transition starts
transition‐delay:
2s;
Multiple transitions
Each with their own start time

transition‐property:
background‐color,
width;

transition‐duration:
1s,
3s;
Transition shorthand
Order of properties: property, duration, timing-
function, delay.

transition:
all
1s
ease‐in
2s;
2D Transforms
Transform element size, position, rotation, skew,
etc.
Transform origin
What point does the transform occur around?
transform‐origin:
3em
bottom;
transform‐origin:
center;
transform‐origin:
20%
50%;
Moving elements
Along X and Y elements

transform:
translateX(50px);
transform:
translateY(100px);
transform:
translate(50px,
100px);
Resizing elements
By a set scale factor

transform:
scale(1.1);
Skewing elements
Squishy distortion!

transform:
skew(7deg,
3deg);
Rotating elements
Around the origin point

transform:
rotate(3deg);
Combining transforms
Doing multiple things in one declaration

transform:
scale(2)
rotate(10deg)
translateX(30px);
Combining transitions with
transforms
This is where it starts to get really fun!

li
a
.menubutton
{


transition:
0.5s
all;


transform‐origin:
center;


transform:
scale(1);


opacity:
0.5;
}
Combining transitions with
transforms
li
a
.menubutton:hover
{


opacity:
1;


transform:
scale(1.1);
}
Web fonts
‣ Download custom fonts along with your web
  pages
‣ Solve our typography nightmares
Include the font
@font‐face
{


font‐family:
“My
font”;


src:
url(http://www.myweb.com/fonts/myfont.ttf);


format(“truetype”);
}
Then use it in your page as
normal
p
{


font‐family:
“My
font”;
}
Web fonts issues
‣ Licensing
‣ Large downloads
‣ Cross browser troubles: multiple formats needed
Browser format support
‣ Opera 10.6+: OpenType, TrueType, SVG
‣ IE9 + : EOT, OpenType, WOFF
‣ Firefox 3.6+ : OpenType, TrueType, WOFF
‣ Chrome 6+ : OpenType, TrueType, SVG
‣ Safari 5+ : OpenType, TrueType
Font squirrel rocks
This is what you need!
@font‐face
{


font‐family:
'ActionIsRegular';


src:
url('actionis‐webfont.eot?')
format('eot'),







url('actionis‐webfont.woff')
format('woff'),







url('actionis‐webfont.ttf')

format('truetype'),







url('actionis‐webfont.svg#webfontg3JxrxOm')

format('svg');


font‐weight:
normal;


font‐style:
normal;
}
Media queries
Media types on steroids
‣ Apply CSS depending on device/browser
  attributes
‣ Very useful for optimizing layouts for different
  devices
‣ (http://people.opera.com/danield/css3/vangogh/
  index.php)
‣ http://mediaqueri.es
Device attributes
‣ Browser width/height
‣ Device width/height
‣ Resolution
‣ Aspect ratio
‣ Monochromacity
‣ etc.
A sample media query
@media
all
and
(max‐width:
480px),
all
and
(max‐
device‐width:
480px)
{


...
}
CSS3 Selectors
[attr*str]        :nth‐last‐of‐type(n)
[attr^str]        :nth‐last‐child(n)
[attr~str]        :only‐child
:first‐child      :only‐of‐type
:last‐child       :checked
:first‐of‐type    :valid
:last‐of‐type     :invalid
:nth‐child(n)     :enabled       :target
:nth‐of‐type(n)   :disabled      And
more!
CSS3 Selector examples
article>p:nth‐of‐type(1)
article>p:first‐of‐type
div[id*=page]:target
p:first‐child
input[type=text]:valid
tr:nth‐child(2n+1)
tr:nth‐child(odd)
:target is cool!
<li><a
href="#page1"><p
class="menubutton">Page
1</
p></a></li>
<li><a
href="#page2"><p
class="menubutton">Page
2</
p></a></li>

<div
id="page1"></div>
<div
id="page2"></div>
:target is cool!
div[id*=page]
{


position:
absolute;


width:
440px;
height:
480px;


padding:
20px
30px
20px
30px;


opacity:
0;


transition:
1s
all;
}
:target is cool!
div[id*=page]:target
{


opacity:
1;


z‐index:
5;
}
object-fit, object-position
img
{


object‐fit:
none;


//
also
takes
contain,
cover
and
fill
values


object‐position:
25%
50%;


//
just
like
background‐position
}
Multiple backgrounds
header
{


background:
url(icon.gif)
top
left
no‐repeat,














url(pattern.jpg)
repeat,














url(center‐spine.png)
top
center














repeat‐y;


}
CSS keyframe animation
@‐webkit‐keyframes
heartmove
{


0%
{




padding‐left:
0px;
padding‐top:
0px;


}



50%
{




padding‐left:
4px;
padding‐top:
4px;


}


100%
{




padding‐left:
0px;
padding‐top:
0px;


}
}
CSS keyframe animation
.heartmove
{


‐webkit‐animation‐name:
heartmove;


‐webkit‐animation‐duration:
0.5s;


‐webkit‐animation‐iteration‐count:
infinite;
}
And there’s more!
‣ 3D transforms
‣ multi-col
‣ Flex box
‣ Animation
‣ Gradients
‣ Reflections...
‣ ..and it goes on...
Thanks for listening!
‣ cmills@opera.com
‣ @chrisdavidmills
‣ http://dev.opera.com
‣ http://www.opera.com/wsc
‣ http://interactwithwebstandards.com

More Related Content

KEY
Angels versus demons: balancing shiny and inclusive
Chris Mills
 
PDF
JavaScript History
Rhio Kim
 
PDF
A Period of Transition
Jens Grochtdreis
 
PDF
CSS3: The Future is Now at DrupalCon San Francisco
Jen Simmons
 
PDF
Banquet 36
Koubei UED
 
KEY
CSS3: stay tuned for style
Chris Mills
 
PPTX
PhpStorm - A WordPress Journey from Notepad to PhpStorm
Edward Caissie
 
PPTX
HTML / CSS / JS Web basics
btopro
 
Angels versus demons: balancing shiny and inclusive
Chris Mills
 
JavaScript History
Rhio Kim
 
A Period of Transition
Jens Grochtdreis
 
CSS3: The Future is Now at DrupalCon San Francisco
Jen Simmons
 
Banquet 36
Koubei UED
 
CSS3: stay tuned for style
Chris Mills
 
PhpStorm - A WordPress Journey from Notepad to PhpStorm
Edward Caissie
 
HTML / CSS / JS Web basics
btopro
 

Viewers also liked (6)

PPTX
Introduction to whats new in css3
Usman Mehmood
 
PDF
Css3
Inbal Geffen
 
KEY
CSS3: stay tuned for style
Chris Mills
 
PPTX
Presentation about html5 css3
Gopi A
 
PPTX
Introduction to HTML5 & CSS3
Pradeep Varadaraja Banavara
 
PPTX
Node.JS and WebSockets with Faye
Matjaž Lipuš
 
Introduction to whats new in css3
Usman Mehmood
 
CSS3: stay tuned for style
Chris Mills
 
Presentation about html5 css3
Gopi A
 
Introduction to HTML5 & CSS3
Pradeep Varadaraja Banavara
 
Node.JS and WebSockets with Faye
Matjaž Lipuš
 
Ad

Similar to CSS3: the new style council (20)

PPT
CSS3 and a brief introduction to Google Maps API v3
Jeffrey Barke
 
PPT
Html5/CSS3
Simratpreet Singh
 
PPTX
Css3 shubelal
Shub
 
PPTX
Introduction to CSS3
hstryk
 
PDF
CSS3 - is everything we used to do wrong?
Russ Weakley
 
PDF
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Erin M. Kidwell
 
KEY
The web standards gentleman: a matter of (evolving) standards)
Chris Mills
 
KEY
Ease into HTML5 and CSS3
Brian Moon
 
PDF
Simply Responsive CSS3
Denise Jacobs
 
KEY
Core CSS3
Rachel Andrew
 
PDF
Intro to CSS3
Denise Jacobs
 
PDF
CSS3: Ripe and Ready to Respond
Denise Jacobs
 
PDF
Css3
Renzil D'cruz
 
PDF
CSS3: Ripe and Ready
Denise Jacobs
 
PPTX
Css3
Anjan Banda
 
KEY
CSS and CSS3
Robyn Overstreet
 
PDF
HTML5 for the Flash Developer
DevelopmentArc LLC
 
PPTX
CSS 3
Ryan Street
 
PDF
20111129 modernizr
brooky-yen
 
CSS3 and a brief introduction to Google Maps API v3
Jeffrey Barke
 
Html5/CSS3
Simratpreet Singh
 
Css3 shubelal
Shub
 
Introduction to CSS3
hstryk
 
CSS3 - is everything we used to do wrong?
Russ Weakley
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Erin M. Kidwell
 
The web standards gentleman: a matter of (evolving) standards)
Chris Mills
 
Ease into HTML5 and CSS3
Brian Moon
 
Simply Responsive CSS3
Denise Jacobs
 
Core CSS3
Rachel Andrew
 
Intro to CSS3
Denise Jacobs
 
CSS3: Ripe and Ready to Respond
Denise Jacobs
 
CSS3: Ripe and Ready
Denise Jacobs
 
CSS and CSS3
Robyn Overstreet
 
HTML5 for the Flash Developer
DevelopmentArc LLC
 
20111129 modernizr
brooky-yen
 
Ad

More from Chris Mills (20)

PDF
More efficient, usable web
Chris Mills
 
PDF
Feedback handling, community wrangling, panhandlin’
Chris Mills
 
PDF
APIs for modern web apps
Chris Mills
 
PDF
APIs, now and in the future
Chris Mills
 
PDF
Guerrilla education
Chris Mills
 
PDF
Web versus Native: round 1!
Chris Mills
 
PDF
BrazilJS MDN
Chris Mills
 
PDF
Empowering the "mobile web"
Chris Mills
 
PDF
Documentation and publishing
Chris Mills
 
PDF
MDN is easy!
Chris Mills
 
PDF
Getting rid of images with CSS
Chris Mills
 
PDF
Future layouts
Chris Mills
 
PDF
Laying out the future
Chris Mills
 
PDF
Accessibility doesn't exist
Chris Mills
 
PDF
Responsive web design standards?
Chris Mills
 
PDF
Adapt! Media queries and viewport
Chris Mills
 
PDF
Adapt and respond: keeping responsive into the future
Chris Mills
 
PDF
HTML5 and CSS3: does now really mean now?
Chris Mills
 
PDF
The W3C and the web design ecosystem
Chris Mills
 
PDF
HTML5 Pearson preso
Chris Mills
 
More efficient, usable web
Chris Mills
 
Feedback handling, community wrangling, panhandlin’
Chris Mills
 
APIs for modern web apps
Chris Mills
 
APIs, now and in the future
Chris Mills
 
Guerrilla education
Chris Mills
 
Web versus Native: round 1!
Chris Mills
 
BrazilJS MDN
Chris Mills
 
Empowering the "mobile web"
Chris Mills
 
Documentation and publishing
Chris Mills
 
MDN is easy!
Chris Mills
 
Getting rid of images with CSS
Chris Mills
 
Future layouts
Chris Mills
 
Laying out the future
Chris Mills
 
Accessibility doesn't exist
Chris Mills
 
Responsive web design standards?
Chris Mills
 
Adapt! Media queries and viewport
Chris Mills
 
Adapt and respond: keeping responsive into the future
Chris Mills
 
HTML5 and CSS3: does now really mean now?
Chris Mills
 
The W3C and the web design ecosystem
Chris Mills
 
HTML5 Pearson preso
Chris Mills
 

Recently uploaded (20)

PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
Doc9.....................................
SofiaCollazos
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Doc9.....................................
SofiaCollazos
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
The Future of Artificial Intelligence (AI)
Mukul
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 

CSS3: the new style council

Editor's Notes