SlideShare ist ein Scribd-Unternehmen logo
1 von 115
Downloaden Sie, um offline zu lesen
CSS Lessons Learned the Hard Way 
Zoe Mickley Gillenwater 
@zomigi 
Beyond Tellerand 
Berlin 4 November 2014
I make things…
…some of which come out nicely…
Web sites
Books 
Stunning CSS3: A Project-based Guide to the Latest in CSS 
www.stunningcss3.com 
Flexible Web Design: Creating Liquid and Elastic Layouts with CSS 
www.flexiblewebbook.com
Kids
Cakes
…but sometimes I make mistakes…
Gardening
Gardening 
https://www.flickr.com/photos/coachjeff/3600883487/
“I can’t start until I know enough to do it perfectly.”
You don’t need everything 
http://www.flickr.com/photos/montage_man/4713541238/
Start using Sass in four easy steps.
Install Prepros from http://alphapixels.com/prepros/ 
Step 1
Drag your web site’s folder into Prepros. 
Step 2
In this folder, create a file named styles.scss. 
Step 3
Write in it this: 
Step 4 
$green: #4F9F1A; 
$blue: #1D6783; 
$lightgray: #D6D6D6; 
body { 
background: $lightgray; 
color: $green; 
} 
a { 
color: $blue; 
} 
button { 
background: $blue; 
color: $lightgray; 
}
Never compare your inside with somebody else’s outside.
If you walk around with the idea that there are some people who are so gifted—they have these wonderful things in their head, but you’re not one of them, you’re just sort of a normal person, you could never do anything like that— then you live a different kind of life. 
Brian Eno
Innovation requires a mindset that rejects the fear of failure and replaces that fear of failure with the joy of exploration and experimental learning. 
Dr. Edward D. Hess
We also need to accept and embrace the concept of failure, not because failure is a good thing but because it’s a natural part of the path of progress. If you’re failing, at least that means you’re trying — not remaining on the outside of the arena, looking in. 
Helen Walters
Creative people experiment a lot more, therefore succeed a lot more, therefore fail a lot more.
Some of my recent CSS mistakes
Flexbox demo 
www.smoresday.us 
Use Chrome, Opera, Safari 7, Firefox 28+, or IE 10+ for full effect
.action 
.component
HTML without flexbox 
<form class="builder"> 
<div class="wrap"> 
<section class="component"> 
<section class="component"> 
<section class="component"> 
<section class="component"> 
</div> 
<section class="action"> 
</form>
HTML for flexbox version 
<form class="builder"> 
<section class="component"> 
<section class="component"> 
<section class="component"> 
<section class="component"> 
<section class="action"> 
</form>
Allow boxes to wrap 
.builder { 
display: flex; 
flex-wrap: wrap; 
justify-content: space-between; 
margin: 0 0 40px -20px; 
}
Using flex to control width/height 
.flex-item { 
flex: 1 0 100px; 
} 
flex-grow 
flex-shrink 
flex-basis
Defining the flex property 
flex-grow 
how much flex item will grow relative to other items if extra space is available (proportion of extra space that it gets) 
flex-shrink 
how much item will shrink relative to others if there is not enough space (proportion of overflow that gets shaved off) 
flex-basis 
the initial starting size before free space is distributed (any standard width/height value, including auto)
My first attempt 
.component { 
flex: 1; 
} 
.action { 
flex: 1 1 100%; 
} 
Zoe’s Brain Said: 
“Since .action starts out at 100%, it won’t have space to sit on the first line with the content preceding it, and will wrap to a second line.”
Flexbox fail
This fixed it 
.component { 
flex: 1; 
margin-right: 1px; 
}
/* this is needed to make .action wrap to second line. why??? */ 
My comment on the 1px margin
The hidden flex-basis value 
.component { 
flex: 1 1 0px; 
} 
.action { 
flex: 1 1 100%; 
} 
Reality: 
Since it’s fine for each .component to shrink to only 0px wide, a 100% wide element can and will sit on the same line as all the components.
That’s why margin “fixed” it 
.component { 
flex: 1; 
margin-right: 1px; 
} 
.action { 
flex: 1 1 100%; 
} 
What’s happening: 
Now each .component starts out taking up 1px of space, so a 100% wide element can’t and won’t sit on the same line with any of the components.
Fixing flex-basis to force the wrap 
.component { 
flex: 1 1 200px; 
} 
.action { 
flex: 1 1 100%; 
} 
Fixed: 
.action will always wrap to new line, and .component boxes will wrap to additional lines when there’s less space than their combined flex-basis values (plus margin, etc.).
This was not just a case of succeeding despite a mistake. It was a case of succeeding because of a mistake.
flex-basis mistake round two
flex can be proportional 
Setting flex-grow/flex-shrink to different values can make flex items size themselves relative to each other 
flex: 1; 
flex: 1; 
flex: 2;
Trying to make one twice as wide 
.gallery-item { 
flex: 1 0 200px; 
} 
.feature { 
flex: 2 0 200px; 
}
Expected rendering
Actual rendering
What I figured out 
Having widths be in multiples of each other only works if flex-basis is 0 
flex: 1 0 0px; 
flex: 1 0 0px; 
flex: 2 0 0px;
If flex-basis isn’t 0px… 
…the widths may not end up as you expect 
The third box gets twice as much of the extra, but that doesn’t make it twice as wide overall 
flex: 1 0 10px; 
flex: 1 0 10px; 
flex: 2 0 10px; 
10px + 5px extra = 15px 
10px + 5px extra = 15px 
10px + 10px extra = 20px 
if 50px available
It’s because flex-basis = 200px
I really get flex-basis now
Takeaway: don’t use CSS shorthand without understanding all the pieces
Let’s talk about another mistake
Shadow style inspiration 
http://sliderpro.net/examples/minimal-slider/
The plan: create shadow with generated content, skew it with CSS perspective
My first attempt 
.lightbox:before { 
content: ""; 
position: absolute; 
z-index: -2; 
left: 2%; 
bottom: 0; 
width: 96%; 
height: 1px; 
box-shadow: 0 25px 30px 15px hsla(0,0%,0%,.4); 
transform: perspective(20em); 
}
Perspective fail
What does rotateX actually do?
The 3 axes 
X horizontal, left-right 
Y vertical, up-down 
Z away-towards you 
A helpful diagram: your hand. 
Photo: http://www.smashingmagazine.com/2012/01/06/adventures-in-the-third-dimension-css-3-d-transforms/
Or, if your hand is effed up: 
http://architecture.gtu.ge/MPL/Multimodal%20Explorer/Acad_11/14control_workplane0/control_workplane.htm
Rotate around the axis not in the direction of the axis 
As explained well by Peter Gasston in http://www.smashingmagazine.com/2012/01/06/adventures- in-the-third-dimension-css-3-d-transforms/
My quick sketch
Adding rotateX with perspective 
.lightbox:before { 
content: ""; 
position: absolute; 
z-index: -2; 
left: 6%; 
bottom: 0; 
width: 88%; 
height: 1px; 
box-shadow: 0 25px 30px 15px hsla(0,0%,0%,.4); 
transform: perspective(20em) rotateX(50deg); 
}
Perspective working
Takeaway: sometimes pen and paper can make a new concept real to you
A two-dimensional problem
Absolute positioning
https://www.flickr.com/photos/40325561@N04/8176648959/ 
Web layout is horizontally biased
Flexbox is not row-centric 
.container { 
display: flex; 
flex-direction: column-reverse; 
align-items: flex-start; 
min-height: 200px; 
}
Correct 
IE 11 min-height bug
Fixed with another flex wrapper 
<div class="outer"> 
<div class="container"> 
<div class="bottom">...</div> 
</div> 
</div> 
.outer { 
display: flex; 
}
Takeaway: thinking about web layout in rows can be limiting
Is using flexbox another one of my mistakes?
Flexbox fallback #1: Do nothing. (Seriously.)
Flexbox fallback #2: display: table-cell
Flexbox fallback #3: float (but be careful)
Flexbox with float 
.container { 
display: -webkit-box; 
display: flex; 
} 
.sidebar { 
float: left; 
position: relative; 
width: 300px; 
} 
.no-flexbox .main-content { 
margin-left: 300px; 
}
Flexbox fallback example 
Without flexbox (IE 9) 
With flexbox (Chrome)
Flexbox with float fallback 
.iw_mini_details_wrapper { 
display: flex; 
flex-wrap: wrap; 
justify-content: space-between; 
align-items: baseline; 
} 
.iw_mini_review_score_wrapper { 
float: left; 
} 
.iw_mini_price_wrapper { 
float: right; 
}
A more public mistake
Sometimes you need to add special content for screen reader users…
…and occasionally you need to hide content from screen reader users.
I needed CSS classes to: 
1.Hide content visually and aurally 
2.Hide just the text of an element, not whole element, but keep text spoken 
3.Hide whole element visually but keep its text spoken by screen readers
Hide content visually and aurally 
.hidden-silent { 
display: none; 
visibility: hidden; 
}
Hide text only but keep it spoken 
.hidden-text-spoken { 
text-indent: -999em; 
overflow: hidden; 
display: inline-block; 
}
Hide element but keep it spoken 
Yahoo! Accessibility blog said to use: 
.hidden-spoken { 
position: absolute !important; 
clip: rect(1px 1px 1px 1px); /* IE 6-7 */ 
clip: rect(1px, 1px, 1px, 1px); 
padding: 0 !important; 
border: 0 !important; 
height: 1px !important; 
width: 1px !important; 
overflow: hidden; 
} 
Article now online at https://developer.yahoo.com/blogs/ydn/clip-hidden-content-better-accessibility-53456.html
Problem: NVDA in Firefox wouldn’t read <label> with this class
https://www.flickr.com/photos/87255087@N00/6261885005/ 
Delete half the code, see if bug goes away, repeat
I narrowed it down to overflow: hidden 
Removing this part caused labels to be read correctly in Firefox by NVDA
But removing it still kept the content hidden. 
So why was it there to begin with?
This scrollbar is what overflow fixes
Now that I understood what overflow did, I could decide if I needed it.
How I fixed my mistake 
•Removed overflow:hidden from new instances going forward (but sadly not fixed in existing style sheets) 
•Updated documentation to advise adding it on as-needed basis
(By the way, this FF/NVDA bug seems to be gone now.)
Takeaway: one-size-fits-all isn’t always best for your needs
Takeaway: you can get help when you share your confusion publicly
Be willing to fail…
…and then tell us about it.
Vulnerability is the birthplace of innovation, creativity, and change. To create is to make something that has never existed before. There's nothing more vulnerable than that. 
Dr. Brené Brown
Sharing mistakes has benefits
http://www.flickr.com/photos/stilleben/49644790/
We all do imperfect work
/* this is needed to make .action wrap to second line. why??? */
The evidence in the comments 
// Dear future me. Please forgive me. // I can't even begin to express how sorry I am. 
// I am not sure if we need this, but too scared to delete. 
// Magic. Do not touch.
Revisiting comments 
// TODO: Fix this. Fix what? 
// somedev1 - 6/7/02 Adding temporary tracking of Login screen // somedev2 - 5/22/07 Temporary my ass
99% of the population of the world doesn’t know CSS. 
Zoe’s made-up statistic
You are awesome, but and you make mistakes.
Let’s use our confidence in our skills to build others up and bravely admit our own shortcomings.
Thank you 
Zoe Mickley Gillenwater 
@zomigi 
Beyond Tellerand 
Berlin 4 November 2014

Weitere ähnliche Inhalte

Was ist angesagt?

Building a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToBuilding a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToRaymond Camden
 
How to Make WordPress Your Friend
How to Make WordPress Your FriendHow to Make WordPress Your Friend
How to Make WordPress Your Friendkerchmcc
 
Create finished floors by room outlines
Create finished floors by room outlinesCreate finished floors by room outlines
Create finished floors by room outlinesWojciech Klepacki
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppKaty Slemon
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFXRichard Bair
 
Magento 2 Front-end performance tips & tricks - Nomadmage September 2017
Magento 2 Front-end performance tips & tricks - Nomadmage September 2017Magento 2 Front-end performance tips & tricks - Nomadmage September 2017
Magento 2 Front-end performance tips & tricks - Nomadmage September 2017Bartek Igielski
 
Future of Mobile Web - Coldfront conf
Future of Mobile Web - Coldfront confFuture of Mobile Web - Coldfront conf
Future of Mobile Web - Coldfront confPaul Kinlan
 
XAML Development with Xamarin - Jesse Liberty | FalafelCON 2014
XAML Development with Xamarin  - Jesse Liberty | FalafelCON 2014XAML Development with Xamarin  - Jesse Liberty | FalafelCON 2014
XAML Development with Xamarin - Jesse Liberty | FalafelCON 2014FalafelSoftware
 
Rich Internet Applications (RIA) Web Testing
Rich Internet Applications (RIA) Web TestingRich Internet Applications (RIA) Web Testing
Rich Internet Applications (RIA) Web TestingMathias Roth
 
Making Your Site Look Great in IE7
Making Your Site Look Great in IE7Making Your Site Look Great in IE7
Making Your Site Look Great in IE7goodfriday
 
4007655 introduction-to-javascript
4007655 introduction-to-javascript4007655 introduction-to-javascript
4007655 introduction-to-javascriptVikash Chandra
 
(For non-developers) HTML5: A richer web for everyone
(For non-developers) HTML5: A richer web for everyone(For non-developers) HTML5: A richer web for everyone
(For non-developers) HTML5: A richer web for everyoneChris Mills
 
Deploying a MVC3 WebService in Windows Azure
Deploying a MVC3 WebService in Windows AzureDeploying a MVC3 WebService in Windows Azure
Deploying a MVC3 WebService in Windows AzureMahesh Dahal
 

Was ist angesagt? (15)

Building a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToBuilding a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared To
 
How to Make WordPress Your Friend
How to Make WordPress Your FriendHow to Make WordPress Your Friend
How to Make WordPress Your Friend
 
Create finished floors by room outlines
Create finished floors by room outlinesCreate finished floors by room outlines
Create finished floors by room outlines
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular App
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFX
 
Magento 2 Front-end performance tips & tricks - Nomadmage September 2017
Magento 2 Front-end performance tips & tricks - Nomadmage September 2017Magento 2 Front-end performance tips & tricks - Nomadmage September 2017
Magento 2 Front-end performance tips & tricks - Nomadmage September 2017
 
Future of Mobile Web - Coldfront conf
Future of Mobile Web - Coldfront confFuture of Mobile Web - Coldfront conf
Future of Mobile Web - Coldfront conf
 
XAML Development with Xamarin - Jesse Liberty | FalafelCON 2014
XAML Development with Xamarin  - Jesse Liberty | FalafelCON 2014XAML Development with Xamarin  - Jesse Liberty | FalafelCON 2014
XAML Development with Xamarin - Jesse Liberty | FalafelCON 2014
 
Oscon 20080724
Oscon 20080724Oscon 20080724
Oscon 20080724
 
Rich Internet Applications (RIA) Web Testing
Rich Internet Applications (RIA) Web TestingRich Internet Applications (RIA) Web Testing
Rich Internet Applications (RIA) Web Testing
 
Making Your Site Look Great in IE7
Making Your Site Look Great in IE7Making Your Site Look Great in IE7
Making Your Site Look Great in IE7
 
Web components
Web componentsWeb components
Web components
 
4007655 introduction-to-javascript
4007655 introduction-to-javascript4007655 introduction-to-javascript
4007655 introduction-to-javascript
 
(For non-developers) HTML5: A richer web for everyone
(For non-developers) HTML5: A richer web for everyone(For non-developers) HTML5: A richer web for everyone
(For non-developers) HTML5: A richer web for everyone
 
Deploying a MVC3 WebService in Windows Azure
Deploying a MVC3 WebService in Windows AzureDeploying a MVC3 WebService in Windows Azure
Deploying a MVC3 WebService in Windows Azure
 

Andere mochten auch

Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015beyond tellerrand
 
Designing Socially Impactful Digital Experiences
Designing Socially Impactful Digital ExperiencesDesigning Socially Impactful Digital Experiences
Designing Socially Impactful Digital ExperiencesCatt Small
 
Dealing with the fall-out – Elliot Jay Stocks
Dealing with the fall-out – Elliot Jay StocksDealing with the fall-out – Elliot Jay Stocks
Dealing with the fall-out – Elliot Jay Stocksbeyond tellerrand
 
Advancing the web without breaking it - #btconf
Advancing the web without breaking it - #btconfAdvancing the web without breaking it - #btconf
Advancing the web without breaking it - #btconfChristian Heilmann
 
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Webbeyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than WebHeiko Behrens
 
The Icon Design Process – Jon Hicks
The Icon Design Process – Jon HicksThe Icon Design Process – Jon Hicks
The Icon Design Process – Jon Hicksbeyond tellerrand
 
Chip Kidd - ! Or ? - btconfBER2015
Chip Kidd - ! Or ? - btconfBER2015Chip Kidd - ! Or ? - btconfBER2015
Chip Kidd - ! Or ? - btconfBER2015beyond tellerrand
 
Content amid Chaos - beyond tellerrand Dusseldorf 2015
Content amid Chaos - beyond tellerrand Dusseldorf 2015Content amid Chaos - beyond tellerrand Dusseldorf 2015
Content amid Chaos - beyond tellerrand Dusseldorf 2015beyond tellerrand
 
Reusable Code - For Good or For Awesome!
Reusable Code - For Good or For Awesome!Reusable Code - For Good or For Awesome!
Reusable Code - For Good or For Awesome!Jake Archibald
 
Cheat Your Way With UX
Cheat Your Way With UXCheat Your Way With UX
Cheat Your Way With UXstephtroeth
 
The Physical Web is a Speed Issue - Velocity 2015
The Physical Web is a Speed Issue - Velocity 2015The Physical Web is a Speed Issue - Velocity 2015
The Physical Web is a Speed Issue - Velocity 2015Scott Jenson
 
Imagining the physical web
Imagining the physical webImagining the physical web
Imagining the physical webyiibu
 
Crafting Rich Experiences with Progressive Enhancement [Beyond Tellerrand 2011]
Crafting Rich Experiences with Progressive Enhancement [Beyond Tellerrand 2011]Crafting Rich Experiences with Progressive Enhancement [Beyond Tellerrand 2011]
Crafting Rich Experiences with Progressive Enhancement [Beyond Tellerrand 2011]Aaron Gustafson
 
Connecting The Digital To Analog - Brian Suda
Connecting The Digital To Analog - Brian SudaConnecting The Digital To Analog - Brian Suda
Connecting The Digital To Analog - Brian Sudabeyond tellerrand
 
Designing Meaningful Animation
Designing Meaningful AnimationDesigning Meaningful Animation
Designing Meaningful AnimationVal Head
 
Designing with Empathy [Beyond Tellerrand 2013]
Designing with Empathy [Beyond Tellerrand 2013]Designing with Empathy [Beyond Tellerrand 2013]
Designing with Empathy [Beyond Tellerrand 2013]Aaron Gustafson
 
Who Cares About Content?
Who Cares About Content?Who Cares About Content?
Who Cares About Content?Steph Hay
 
The Emerging Global Web
The Emerging Global WebThe Emerging Global Web
The Emerging Global Webyiibu
 

Andere mochten auch (19)

Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
 
Designing Socially Impactful Digital Experiences
Designing Socially Impactful Digital ExperiencesDesigning Socially Impactful Digital Experiences
Designing Socially Impactful Digital Experiences
 
Dealing with the fall-out – Elliot Jay Stocks
Dealing with the fall-out – Elliot Jay StocksDealing with the fall-out – Elliot Jay Stocks
Dealing with the fall-out – Elliot Jay Stocks
 
Advancing the web without breaking it - #btconf
Advancing the web without breaking it - #btconfAdvancing the web without breaking it - #btconf
Advancing the web without breaking it - #btconf
 
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Webbeyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
 
The Icon Design Process – Jon Hicks
The Icon Design Process – Jon HicksThe Icon Design Process – Jon Hicks
The Icon Design Process – Jon Hicks
 
Chip Kidd - ! Or ? - btconfBER2015
Chip Kidd - ! Or ? - btconfBER2015Chip Kidd - ! Or ? - btconfBER2015
Chip Kidd - ! Or ? - btconfBER2015
 
Content amid Chaos - beyond tellerrand Dusseldorf 2015
Content amid Chaos - beyond tellerrand Dusseldorf 2015Content amid Chaos - beyond tellerrand Dusseldorf 2015
Content amid Chaos - beyond tellerrand Dusseldorf 2015
 
Reusable Code - For Good or For Awesome!
Reusable Code - For Good or For Awesome!Reusable Code - For Good or For Awesome!
Reusable Code - For Good or For Awesome!
 
Cheat Your Way With UX
Cheat Your Way With UXCheat Your Way With UX
Cheat Your Way With UX
 
The Physical Web is a Speed Issue - Velocity 2015
The Physical Web is a Speed Issue - Velocity 2015The Physical Web is a Speed Issue - Velocity 2015
The Physical Web is a Speed Issue - Velocity 2015
 
Imagining the physical web
Imagining the physical webImagining the physical web
Imagining the physical web
 
Crafting Rich Experiences with Progressive Enhancement [Beyond Tellerrand 2011]
Crafting Rich Experiences with Progressive Enhancement [Beyond Tellerrand 2011]Crafting Rich Experiences with Progressive Enhancement [Beyond Tellerrand 2011]
Crafting Rich Experiences with Progressive Enhancement [Beyond Tellerrand 2011]
 
Connecting The Digital To Analog - Brian Suda
Connecting The Digital To Analog - Brian SudaConnecting The Digital To Analog - Brian Suda
Connecting The Digital To Analog - Brian Suda
 
Designing Meaningful Animation
Designing Meaningful AnimationDesigning Meaningful Animation
Designing Meaningful Animation
 
Designing with Empathy [Beyond Tellerrand 2013]
Designing with Empathy [Beyond Tellerrand 2013]Designing with Empathy [Beyond Tellerrand 2013]
Designing with Empathy [Beyond Tellerrand 2013]
 
Who Cares About Content?
Who Cares About Content?Who Cares About Content?
Who Cares About Content?
 
Atomic design
Atomic designAtomic design
Atomic design
 
The Emerging Global Web
The Emerging Global WebThe Emerging Global Web
The Emerging Global Web
 

Ähnlich wie CSS Lessons Learned The Hard Way – Zoe Gillenwater

CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)Zoe Gillenwater
 
CSS Lessons Learned the Hard Way (ConvergeSE)
CSS Lessons Learned the Hard Way (ConvergeSE)CSS Lessons Learned the Hard Way (ConvergeSE)
CSS Lessons Learned the Hard Way (ConvergeSE)Zoe Gillenwater
 
Leveling Up With Flexbox (Smart Web Conference)
Leveling Up With Flexbox (Smart Web Conference)Leveling Up With Flexbox (Smart Web Conference)
Leveling Up With Flexbox (Smart Web Conference)Zoe Gillenwater
 
Using Flexbox Today (CSS Summit 2016)
Using Flexbox Today (CSS Summit 2016)Using Flexbox Today (CSS Summit 2016)
Using Flexbox Today (CSS Summit 2016)Zoe Gillenwater
 
Putting Flexbox into Practice (Fronteers)
Putting Flexbox into Practice (Fronteers)Putting Flexbox into Practice (Fronteers)
Putting Flexbox into Practice (Fronteers)Zoe Gillenwater
 
Using Flexbox Today (Frontier Conf 2016)
Using Flexbox Today (Frontier Conf 2016)Using Flexbox Today (Frontier Conf 2016)
Using Flexbox Today (Frontier Conf 2016)Zoe Gillenwater
 
Using Flexbox Today (Generate Sydney 2016)
Using Flexbox Today (Generate Sydney 2016)Using Flexbox Today (Generate Sydney 2016)
Using Flexbox Today (Generate Sydney 2016)Zoe Gillenwater
 
Putting Flexbox into Practice
Putting Flexbox into PracticePutting Flexbox into Practice
Putting Flexbox into PracticeZoe Gillenwater
 
Flexbox Will Shock You!
Flexbox Will Shock You!Flexbox Will Shock You!
Flexbox Will Shock You!Scott Vandehey
 
the 5 layers of web accessibility - Open Web Camp II
the 5 layers of web accessibility - Open Web Camp IIthe 5 layers of web accessibility - Open Web Camp II
the 5 layers of web accessibility - Open Web Camp IIDirk Ginader
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorialtutorialsruby
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorialtutorialsruby
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorialtutorialsruby
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorialtutorialsruby
 
Using Flexbox Today (Frontend United 2016)
Using Flexbox Today (Frontend United 2016)Using Flexbox Today (Frontend United 2016)
Using Flexbox Today (Frontend United 2016)Zoe Gillenwater
 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceRachel Andrew
 

Ähnlich wie CSS Lessons Learned The Hard Way – Zoe Gillenwater (20)

CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)CSS Lessons Learned the Hard Way (Generate Conf)
CSS Lessons Learned the Hard Way (Generate Conf)
 
CSS Lessons Learned the Hard Way (ConvergeSE)
CSS Lessons Learned the Hard Way (ConvergeSE)CSS Lessons Learned the Hard Way (ConvergeSE)
CSS Lessons Learned the Hard Way (ConvergeSE)
 
Leveling Up With Flexbox (Smart Web Conference)
Leveling Up With Flexbox (Smart Web Conference)Leveling Up With Flexbox (Smart Web Conference)
Leveling Up With Flexbox (Smart Web Conference)
 
Using Flexbox Today (CSS Summit 2016)
Using Flexbox Today (CSS Summit 2016)Using Flexbox Today (CSS Summit 2016)
Using Flexbox Today (CSS Summit 2016)
 
Putting Flexbox into Practice (Fronteers)
Putting Flexbox into Practice (Fronteers)Putting Flexbox into Practice (Fronteers)
Putting Flexbox into Practice (Fronteers)
 
Using Flexbox Today (Frontier Conf 2016)
Using Flexbox Today (Frontier Conf 2016)Using Flexbox Today (Frontier Conf 2016)
Using Flexbox Today (Frontier Conf 2016)
 
Using Flexbox Today (Generate Sydney 2016)
Using Flexbox Today (Generate Sydney 2016)Using Flexbox Today (Generate Sydney 2016)
Using Flexbox Today (Generate Sydney 2016)
 
Putting Flexbox into Practice
Putting Flexbox into PracticePutting Flexbox into Practice
Putting Flexbox into Practice
 
Flexbox Will Shock You!
Flexbox Will Shock You!Flexbox Will Shock You!
Flexbox Will Shock You!
 
the 5 layers of web accessibility - Open Web Camp II
the 5 layers of web accessibility - Open Web Camp IIthe 5 layers of web accessibility - Open Web Camp II
the 5 layers of web accessibility - Open Web Camp II
 
CSS 201
CSS 201CSS 201
CSS 201
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorial
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorial
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorial
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorial
 
INTRODUCTIONS OF CSS PART 2
INTRODUCTIONS OF CSS PART 2INTRODUCTIONS OF CSS PART 2
INTRODUCTIONS OF CSS PART 2
 
Look ma! No images!
Look ma! No images!Look ma! No images!
Look ma! No images!
 
Css, xhtml, javascript
Css, xhtml, javascriptCss, xhtml, javascript
Css, xhtml, javascript
 
Using Flexbox Today (Frontend United 2016)
Using Flexbox Today (Frontend United 2016)Using Flexbox Today (Frontend United 2016)
Using Flexbox Today (Frontend United 2016)
 
The New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP ConferenceThe New CSS Layout - Dutch PHP Conference
The New CSS Layout - Dutch PHP Conference
 

Kürzlich hochgeladen

Quality by design.. ppt for RA (1ST SEM
Quality by design.. ppt for  RA (1ST SEMQuality by design.. ppt for  RA (1ST SEM
Quality by design.. ppt for RA (1ST SEMCharmi13
 
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...marjmae69
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSebastiano Panichella
 
Genshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxGenshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxJohnree4
 
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRRINDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRRsarwankumar4524
 
The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringSebastiano Panichella
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationNathan Young
 
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Krijn Poppe
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSebastiano Panichella
 
Chizaram's Women Tech Makers Deck. .pptx
Chizaram's Women Tech Makers Deck.  .pptxChizaram's Women Tech Makers Deck.  .pptx
Chizaram's Women Tech Makers Deck. .pptxogubuikealex
 
Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170Escort Service
 
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC  - NANOTECHNOLOGYPHYSICS PROJECT BY MSC  - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC - NANOTECHNOLOGYpruthirajnayak525
 
Event 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxEvent 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxaryanv1753
 
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power
 
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comSaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comsaastr
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...漢銘 謝
 
Anne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptxAnne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptxnoorehahmad
 
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRachelAnnTenibroAmaz
 
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.KathleenAnnCordero2
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxmavinoikein
 

Kürzlich hochgeladen (20)

Quality by design.. ppt for RA (1ST SEM
Quality by design.. ppt for  RA (1ST SEMQuality by design.. ppt for  RA (1ST SEM
Quality by design.. ppt for RA (1ST SEM
 
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
 
Genshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxGenshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptx
 
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRRINDIAN GCP GUIDELINE. for Regulatory  affair 1st sem CRR
INDIAN GCP GUIDELINE. for Regulatory affair 1st sem CRR
 
The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software Engineering
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism Presentation
 
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation Track
 
Chizaram's Women Tech Makers Deck. .pptx
Chizaram's Women Tech Makers Deck.  .pptxChizaram's Women Tech Makers Deck.  .pptx
Chizaram's Women Tech Makers Deck. .pptx
 
Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170
 
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC  - NANOTECHNOLOGYPHYSICS PROJECT BY MSC  - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
 
Event 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxEvent 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptx
 
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
 
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comSaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
 
Anne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptxAnne Frank A Beacon of Hope amidst darkness ppt.pptx
Anne Frank A Beacon of Hope amidst darkness ppt.pptx
 
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATIONRACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
RACHEL-ANN M. TENIBRO PRODUCT RESEARCH PRESENTATION
 
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptx
 

CSS Lessons Learned The Hard Way – Zoe Gillenwater

  • 1. CSS Lessons Learned the Hard Way Zoe Mickley Gillenwater @zomigi Beyond Tellerand Berlin 4 November 2014
  • 3. …some of which come out nicely…
  • 5. Books Stunning CSS3: A Project-based Guide to the Latest in CSS www.stunningcss3.com Flexible Web Design: Creating Liquid and Elastic Layouts with CSS www.flexiblewebbook.com
  • 8. …but sometimes I make mistakes…
  • 11.
  • 12. “I can’t start until I know enough to do it perfectly.”
  • 13. You don’t need everything http://www.flickr.com/photos/montage_man/4713541238/
  • 14. Start using Sass in four easy steps.
  • 15. Install Prepros from http://alphapixels.com/prepros/ Step 1
  • 16. Drag your web site’s folder into Prepros. Step 2
  • 17. In this folder, create a file named styles.scss. Step 3
  • 18. Write in it this: Step 4 $green: #4F9F1A; $blue: #1D6783; $lightgray: #D6D6D6; body { background: $lightgray; color: $green; } a { color: $blue; } button { background: $blue; color: $lightgray; }
  • 19. Never compare your inside with somebody else’s outside.
  • 20. If you walk around with the idea that there are some people who are so gifted—they have these wonderful things in their head, but you’re not one of them, you’re just sort of a normal person, you could never do anything like that— then you live a different kind of life. Brian Eno
  • 21. Innovation requires a mindset that rejects the fear of failure and replaces that fear of failure with the joy of exploration and experimental learning. Dr. Edward D. Hess
  • 22. We also need to accept and embrace the concept of failure, not because failure is a good thing but because it’s a natural part of the path of progress. If you’re failing, at least that means you’re trying — not remaining on the outside of the arena, looking in. Helen Walters
  • 23. Creative people experiment a lot more, therefore succeed a lot more, therefore fail a lot more.
  • 24. Some of my recent CSS mistakes
  • 25. Flexbox demo www.smoresday.us Use Chrome, Opera, Safari 7, Firefox 28+, or IE 10+ for full effect
  • 27. HTML without flexbox <form class="builder"> <div class="wrap"> <section class="component"> <section class="component"> <section class="component"> <section class="component"> </div> <section class="action"> </form>
  • 28. HTML for flexbox version <form class="builder"> <section class="component"> <section class="component"> <section class="component"> <section class="component"> <section class="action"> </form>
  • 29. Allow boxes to wrap .builder { display: flex; flex-wrap: wrap; justify-content: space-between; margin: 0 0 40px -20px; }
  • 30. Using flex to control width/height .flex-item { flex: 1 0 100px; } flex-grow flex-shrink flex-basis
  • 31. Defining the flex property flex-grow how much flex item will grow relative to other items if extra space is available (proportion of extra space that it gets) flex-shrink how much item will shrink relative to others if there is not enough space (proportion of overflow that gets shaved off) flex-basis the initial starting size before free space is distributed (any standard width/height value, including auto)
  • 32. My first attempt .component { flex: 1; } .action { flex: 1 1 100%; } Zoe’s Brain Said: “Since .action starts out at 100%, it won’t have space to sit on the first line with the content preceding it, and will wrap to a second line.”
  • 34. This fixed it .component { flex: 1; margin-right: 1px; }
  • 35. /* this is needed to make .action wrap to second line. why??? */ My comment on the 1px margin
  • 36. The hidden flex-basis value .component { flex: 1 1 0px; } .action { flex: 1 1 100%; } Reality: Since it’s fine for each .component to shrink to only 0px wide, a 100% wide element can and will sit on the same line as all the components.
  • 37. That’s why margin “fixed” it .component { flex: 1; margin-right: 1px; } .action { flex: 1 1 100%; } What’s happening: Now each .component starts out taking up 1px of space, so a 100% wide element can’t and won’t sit on the same line with any of the components.
  • 38. Fixing flex-basis to force the wrap .component { flex: 1 1 200px; } .action { flex: 1 1 100%; } Fixed: .action will always wrap to new line, and .component boxes will wrap to additional lines when there’s less space than their combined flex-basis values (plus margin, etc.).
  • 39. This was not just a case of succeeding despite a mistake. It was a case of succeeding because of a mistake.
  • 41. flex can be proportional Setting flex-grow/flex-shrink to different values can make flex items size themselves relative to each other flex: 1; flex: 1; flex: 2;
  • 42. Trying to make one twice as wide .gallery-item { flex: 1 0 200px; } .feature { flex: 2 0 200px; }
  • 45. What I figured out Having widths be in multiples of each other only works if flex-basis is 0 flex: 1 0 0px; flex: 1 0 0px; flex: 2 0 0px;
  • 46. If flex-basis isn’t 0px… …the widths may not end up as you expect The third box gets twice as much of the extra, but that doesn’t make it twice as wide overall flex: 1 0 10px; flex: 1 0 10px; flex: 2 0 10px; 10px + 5px extra = 15px 10px + 5px extra = 15px 10px + 10px extra = 20px if 50px available
  • 48. I really get flex-basis now
  • 49. Takeaway: don’t use CSS shorthand without understanding all the pieces
  • 50. Let’s talk about another mistake
  • 51. Shadow style inspiration http://sliderpro.net/examples/minimal-slider/
  • 52. The plan: create shadow with generated content, skew it with CSS perspective
  • 53.
  • 54.
  • 55. My first attempt .lightbox:before { content: ""; position: absolute; z-index: -2; left: 2%; bottom: 0; width: 96%; height: 1px; box-shadow: 0 25px 30px 15px hsla(0,0%,0%,.4); transform: perspective(20em); }
  • 57.
  • 58. What does rotateX actually do?
  • 59. The 3 axes X horizontal, left-right Y vertical, up-down Z away-towards you A helpful diagram: your hand. Photo: http://www.smashingmagazine.com/2012/01/06/adventures-in-the-third-dimension-css-3-d-transforms/
  • 60. Or, if your hand is effed up: http://architecture.gtu.ge/MPL/Multimodal%20Explorer/Acad_11/14control_workplane0/control_workplane.htm
  • 61. Rotate around the axis not in the direction of the axis As explained well by Peter Gasston in http://www.smashingmagazine.com/2012/01/06/adventures- in-the-third-dimension-css-3-d-transforms/
  • 63. Adding rotateX with perspective .lightbox:before { content: ""; position: absolute; z-index: -2; left: 6%; bottom: 0; width: 88%; height: 1px; box-shadow: 0 25px 30px 15px hsla(0,0%,0%,.4); transform: perspective(20em) rotateX(50deg); }
  • 65. Takeaway: sometimes pen and paper can make a new concept real to you
  • 69. Flexbox is not row-centric .container { display: flex; flex-direction: column-reverse; align-items: flex-start; min-height: 200px; }
  • 70. Correct IE 11 min-height bug
  • 71. Fixed with another flex wrapper <div class="outer"> <div class="container"> <div class="bottom">...</div> </div> </div> .outer { display: flex; }
  • 72. Takeaway: thinking about web layout in rows can be limiting
  • 73. Is using flexbox another one of my mistakes?
  • 74. Flexbox fallback #1: Do nothing. (Seriously.)
  • 75. Flexbox fallback #2: display: table-cell
  • 76. Flexbox fallback #3: float (but be careful)
  • 77. Flexbox with float .container { display: -webkit-box; display: flex; } .sidebar { float: left; position: relative; width: 300px; } .no-flexbox .main-content { margin-left: 300px; }
  • 78. Flexbox fallback example Without flexbox (IE 9) With flexbox (Chrome)
  • 79. Flexbox with float fallback .iw_mini_details_wrapper { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; } .iw_mini_review_score_wrapper { float: left; } .iw_mini_price_wrapper { float: right; }
  • 80. A more public mistake
  • 81. Sometimes you need to add special content for screen reader users…
  • 82.
  • 83. …and occasionally you need to hide content from screen reader users.
  • 84.
  • 85. I needed CSS classes to: 1.Hide content visually and aurally 2.Hide just the text of an element, not whole element, but keep text spoken 3.Hide whole element visually but keep its text spoken by screen readers
  • 86. Hide content visually and aurally .hidden-silent { display: none; visibility: hidden; }
  • 87. Hide text only but keep it spoken .hidden-text-spoken { text-indent: -999em; overflow: hidden; display: inline-block; }
  • 88. Hide element but keep it spoken Yahoo! Accessibility blog said to use: .hidden-spoken { position: absolute !important; clip: rect(1px 1px 1px 1px); /* IE 6-7 */ clip: rect(1px, 1px, 1px, 1px); padding: 0 !important; border: 0 !important; height: 1px !important; width: 1px !important; overflow: hidden; } Article now online at https://developer.yahoo.com/blogs/ydn/clip-hidden-content-better-accessibility-53456.html
  • 89. Problem: NVDA in Firefox wouldn’t read <label> with this class
  • 91. I narrowed it down to overflow: hidden Removing this part caused labels to be read correctly in Firefox by NVDA
  • 92. But removing it still kept the content hidden. So why was it there to begin with?
  • 93.
  • 94.
  • 95.
  • 96. This scrollbar is what overflow fixes
  • 97. Now that I understood what overflow did, I could decide if I needed it.
  • 98. How I fixed my mistake •Removed overflow:hidden from new instances going forward (but sadly not fixed in existing style sheets) •Updated documentation to advise adding it on as-needed basis
  • 99. (By the way, this FF/NVDA bug seems to be gone now.)
  • 100. Takeaway: one-size-fits-all isn’t always best for your needs
  • 101. Takeaway: you can get help when you share your confusion publicly
  • 102. Be willing to fail…
  • 103. …and then tell us about it.
  • 104. Vulnerability is the birthplace of innovation, creativity, and change. To create is to make something that has never existed before. There's nothing more vulnerable than that. Dr. Brené Brown
  • 105. Sharing mistakes has benefits
  • 107. We all do imperfect work
  • 108. /* this is needed to make .action wrap to second line. why??? */
  • 109. The evidence in the comments // Dear future me. Please forgive me. // I can't even begin to express how sorry I am. // I am not sure if we need this, but too scared to delete. // Magic. Do not touch.
  • 110. Revisiting comments // TODO: Fix this. Fix what? // somedev1 - 6/7/02 Adding temporary tracking of Login screen // somedev2 - 5/22/07 Temporary my ass
  • 111.
  • 112. 99% of the population of the world doesn’t know CSS. Zoe’s made-up statistic
  • 113. You are awesome, but and you make mistakes.
  • 114. Let’s use our confidence in our skills to build others up and bravely admit our own shortcomings.
  • 115. Thank you Zoe Mickley Gillenwater @zomigi Beyond Tellerand Berlin 4 November 2014