SlideShare uma empresa Scribd logo
1 de 18
CSS3 Tricks

Dan Kurtz - dan@selfawaregames.com
What is Word Ace?
What is Word Ace?
What is Word Ace?
Why is CSS3 a Secret?


App coders don’t use CSS
Web programmers use lowest-common-denominator
CSS.
Holdovers from CSS2


Opacity
display: inline-block;
-webkit-border-image
 <div class="border-image-demo1"><span>10</span></div>


  -webkit-border-image: url(../
images/menus/dashboard-newitem-
badge.png) 0 12 0 12 repeat                  12px        12px
stretch;
  border-width: 0px 12px 0px
12px;
                                                   1px
color: #fff;
position: absolute;
top: 50px
min-width: 24px;
height: 28px;
-webkit-border-image: url(images/menus/dashboard-
  newitem-badge.png) 0 12 0 12 repeat stretch;
text-align: center;
line-height: 30px;
border-width: 0px 12px 0px 12px;




/* All the above, plus: */

#border-image-demo2 span {
  position:relative;
  margin: 0 -6px;
  font-size: 16px;
}
Working version
#border-image-demo3 {
  color: #fff;
  min-width: 24px;
  height: 28px;
  position: absolute;
  top: 100px;
  text-align: center;
  line-height: 30px;
  -webkit-border-image: url(images/menus/dashboard-
newitem-badge.png) 0 12 0 12 repeat stretch;
  -webkit-box-sizing: border-box; /* !!! */
  border-width: 0px 12px 0px 12px;
}

#border-image-demo3 span {
  position:relative;
  margin: 0 -6px;
  font-size: 16px;
}
-webkit-transform


It’s like CSS within CSS!
  Whooooooooa. Cosmic.
-webkit-transform: translate(20px, 20px);




-webkit-transform: scale(.5, 1);




                     (also: skew! and combos!)




-webkit-transform: rotate(60deg);
-webkit-transition

 Automatically animate an element when its properties
 change.
 Specify which properties to animate, their duration, and
 the curve.
Example 1: Sliding in.
#loading-screen {
  width: 320px;
  height: 480px;
  position: absolute;
  top: 0px;
  right: -320px;
  -webkit-transition-property: right;
  -webkit-transition-duration: 1s;
  -webkit-transtion-curve: ease-in;
  background-image: url('../images/mainMenu/mainMenu-
background.png');
  z-index: 10000;
}

#loading-screen.active {
  right: 0px;
}
Example 2: Revealing cards
.card {
  display: block;
  width: 50px;
  height: 70px;
  position: relative;
  -webkit-transition-property: -webkit-transform;
  -webkit-transition-duration: .5s;
  -webkit-transform: scale(0, 1);
}

.card.active {
  -webkit-transform: scale(1, 1);
}


myCard.addClassName(‘active’);
Example 2: Revealing cards
.card {
  display: block;
  width: 50px;
  height: 70px;
  position: relative;
  -webkit-transition-property: -webkit-transform;
  -webkit-transition-duration: .5s;
  -webkit-transform: scale(0, 1);
}

.card.active {
  -webkit-transform: scale(1, 1);
}


myCard.addClassName(‘active’);
-webkit-transition-caveats: a-few;

 No easy way to cancel animations.
 Updates don’t happen until the interpreter is idle.
 It’s “hardware-accelerated” but speed is still an issue.
 Palm?
 -webkit-transition-delay doesn’t work.
Other Goodies

text-overflow: ellipsis;
background-color: rgba(0, 0, 0, .7);
  Makes the background 70% opaque.
  Does not affect opacity of element contents.
References
Supported CSS properties in WebKit:
  http://developer.apple.com/documentation/
  appleapplications/Reference/SafariCSSRef/Articles/
  StandardCSSProperties.html
CSS3 Showcase: http://css3.info
Me again: dan@selfawaregames.com

Mais conteúdo relacionado

Mais procurados

Css sprite_maker-1
Css  sprite_maker-1Css  sprite_maker-1
Css sprite_maker-1
lokku
 
Unity is Strength / Happy Designer 3 / 2008.03.29
Unity is Strength / Happy Designer 3 / 2008.03.29Unity is Strength / Happy Designer 3 / 2008.03.29
Unity is Strength / Happy Designer 3 / 2008.03.29
guest519038
 

Mais procurados (11)

Migrating your Web app to Virtual Reality
Migrating your Web app to Virtual RealityMigrating your Web app to Virtual Reality
Migrating your Web app to Virtual Reality
 
The next frontier: WebGL and WebVR
The next frontier: WebGL and WebVRThe next frontier: WebGL and WebVR
The next frontier: WebGL and WebVR
 
Introduction à AngularJS
Introduction à AngularJSIntroduction à AngularJS
Introduction à AngularJS
 
Css sprite_maker-1
Css  sprite_maker-1Css  sprite_maker-1
Css sprite_maker-1
 
HTML GL - 60 FPS and amazing effects by rendering HTML/CSS in WebGL, framewor...
HTML GL - 60 FPS and amazing effects by rendering HTML/CSS in WebGL, framewor...HTML GL - 60 FPS and amazing effects by rendering HTML/CSS in WebGL, framewor...
HTML GL - 60 FPS and amazing effects by rendering HTML/CSS in WebGL, framewor...
 
Angularjs in mobile app
Angularjs in mobile appAngularjs in mobile app
Angularjs in mobile app
 
Unity is Strength / Happy Designer 3 / 2008.03.29
Unity is Strength / Happy Designer 3 / 2008.03.29Unity is Strength / Happy Designer 3 / 2008.03.29
Unity is Strength / Happy Designer 3 / 2008.03.29
 
Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaks
 
HTML GL - возьмите столько FPS, сколько вам нужно!
HTML GL - возьмите столько FPS, сколько вам нужно!HTML GL - возьмите столько FPS, сколько вам нужно!
HTML GL - возьмите столько FPS, сколько вам нужно!
 
Pruebas mostrando pdf's
Pruebas mostrando pdf'sPruebas mostrando pdf's
Pruebas mostrando pdf's
 
CSS Parallax - DotCSS 2014
CSS Parallax - DotCSS 2014CSS Parallax - DotCSS 2014
CSS Parallax - DotCSS 2014
 

Semelhante a PreDevCampSF - CSS3 Tricks

HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte eventHTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
Robert Nyman
 
[A5]deview 2012 pt hds webkit_gpu
[A5]deview 2012 pt hds webkit_gpu[A5]deview 2012 pt hds webkit_gpu
[A5]deview 2012 pt hds webkit_gpu
NAVER D2
 
New Elements & Features in CSS3
New Elements & Features in CSS3New Elements & Features in CSS3
New Elements & Features in CSS3
Jamshid Hashimi
 
Building the new AppExchange using Responsive Design
Building the new AppExchange using Responsive DesignBuilding the new AppExchange using Responsive Design
Building the new AppExchange using Responsive Design
Salesforce Developers
 

Semelhante a PreDevCampSF - CSS3 Tricks (20)

Html5
Html5Html5
Html5
 
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte eventHTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
 
I Can't Believe It's Not Flash
I Can't Believe It's Not FlashI Can't Believe It's Not Flash
I Can't Believe It's Not Flash
 
CSS3 Takes on the World
CSS3 Takes on the WorldCSS3 Takes on the World
CSS3 Takes on the World
 
[A5]deview 2012 pt hds webkit_gpu
[A5]deview 2012 pt hds webkit_gpu[A5]deview 2012 pt hds webkit_gpu
[A5]deview 2012 pt hds webkit_gpu
 
HTML5 y CSS3
HTML5 y CSS3HTML5 y CSS3
HTML5 y CSS3
 
Css3
Css3Css3
Css3
 
Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017 Make Your Animations Perform Well - JS Conf Budapest 2017
Make Your Animations Perform Well - JS Conf Budapest 2017
 
Css animation
Css animationCss animation
Css animation
 
Making Links Magical Again with CSS
Making Links Magical Again with CSSMaking Links Magical Again with CSS
Making Links Magical Again with CSS
 
CSS3: Ready for Primetime?
CSS3: Ready for Primetime?CSS3: Ready for Primetime?
CSS3: Ready for Primetime?
 
Web Design Trends 2010 - What Is CSS3 All About?
Web Design Trends 2010 - What Is CSS3 All About?Web Design Trends 2010 - What Is CSS3 All About?
Web Design Trends 2010 - What Is CSS3 All About?
 
New Elements & Features in CSS3
New Elements & Features in CSS3New Elements & Features in CSS3
New Elements & Features in CSS3
 
CSS3 pronti all'uso
CSS3 pronti all'usoCSS3 pronti all'uso
CSS3 pronti all'uso
 
CSS and CSS3
CSS and CSS3CSS and CSS3
CSS and CSS3
 
Responsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da WebResponsive Web Design e a Ubiquidade da Web
Responsive Web Design e a Ubiquidade da Web
 
Building the new AppExchange using Responsive Design
Building the new AppExchange using Responsive DesignBuilding the new AppExchange using Responsive Design
Building the new AppExchange using Responsive Design
 
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017
 
Make your animations perform well
Make your animations perform wellMake your animations perform well
Make your animations perform well
 
HalfStack London - Make Your Animations Perform Well
HalfStack London - Make Your Animations Perform Well HalfStack London - Make Your Animations Perform Well
HalfStack London - Make Your Animations Perform Well
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

PreDevCampSF - CSS3 Tricks

  • 1. CSS3 Tricks Dan Kurtz - dan@selfawaregames.com
  • 5. Why is CSS3 a Secret? App coders don’t use CSS Web programmers use lowest-common-denominator CSS.
  • 7. -webkit-border-image <div class="border-image-demo1"><span>10</span></div> -webkit-border-image: url(../ images/menus/dashboard-newitem- badge.png) 0 12 0 12 repeat 12px 12px stretch; border-width: 0px 12px 0px 12px; 1px
  • 8. color: #fff; position: absolute; top: 50px min-width: 24px; height: 28px; -webkit-border-image: url(images/menus/dashboard- newitem-badge.png) 0 12 0 12 repeat stretch; text-align: center; line-height: 30px; border-width: 0px 12px 0px 12px; /* All the above, plus: */ #border-image-demo2 span { position:relative; margin: 0 -6px; font-size: 16px; }
  • 9. Working version #border-image-demo3 { color: #fff; min-width: 24px; height: 28px; position: absolute; top: 100px; text-align: center; line-height: 30px; -webkit-border-image: url(images/menus/dashboard- newitem-badge.png) 0 12 0 12 repeat stretch; -webkit-box-sizing: border-box; /* !!! */ border-width: 0px 12px 0px 12px; } #border-image-demo3 span { position:relative; margin: 0 -6px; font-size: 16px; }
  • 10. -webkit-transform It’s like CSS within CSS! Whooooooooa. Cosmic.
  • 11. -webkit-transform: translate(20px, 20px); -webkit-transform: scale(.5, 1); (also: skew! and combos!) -webkit-transform: rotate(60deg);
  • 12. -webkit-transition Automatically animate an element when its properties change. Specify which properties to animate, their duration, and the curve.
  • 13. Example 1: Sliding in. #loading-screen { width: 320px; height: 480px; position: absolute; top: 0px; right: -320px; -webkit-transition-property: right; -webkit-transition-duration: 1s; -webkit-transtion-curve: ease-in; background-image: url('../images/mainMenu/mainMenu- background.png'); z-index: 10000; } #loading-screen.active { right: 0px; }
  • 14. Example 2: Revealing cards .card { display: block; width: 50px; height: 70px; position: relative; -webkit-transition-property: -webkit-transform; -webkit-transition-duration: .5s; -webkit-transform: scale(0, 1); } .card.active { -webkit-transform: scale(1, 1); } myCard.addClassName(‘active’);
  • 15. Example 2: Revealing cards .card { display: block; width: 50px; height: 70px; position: relative; -webkit-transition-property: -webkit-transform; -webkit-transition-duration: .5s; -webkit-transform: scale(0, 1); } .card.active { -webkit-transform: scale(1, 1); } myCard.addClassName(‘active’);
  • 16. -webkit-transition-caveats: a-few; No easy way to cancel animations. Updates don’t happen until the interpreter is idle. It’s “hardware-accelerated” but speed is still an issue. Palm? -webkit-transition-delay doesn’t work.
  • 17. Other Goodies text-overflow: ellipsis; background-color: rgba(0, 0, 0, .7); Makes the background 70% opaque. Does not affect opacity of element contents.
  • 18. References Supported CSS properties in WebKit: http://developer.apple.com/documentation/ appleapplications/Reference/SafariCSSRef/Articles/ StandardCSSProperties.html CSS3 Showcase: http://css3.info Me again: dan@selfawaregames.com