SlideShare a Scribd company logo
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

More Related Content

What's hot

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
Raymond Camden
 
How to Make WordPress Your Friend
How to Make WordPress Your FriendHow to Make WordPress Your Friend
How to Make WordPress Your Friend
kerchmcc
 
Create finished floors by room outlines
Create finished floors by room outlinesCreate finished floors by room outlines
Create finished floors by room outlines
Wojciech 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 App
Katy Slemon
 
Enterprising JavaFX
Enterprising JavaFXEnterprising JavaFX
Enterprising JavaFX
Richard 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 2017
Bartek Igielski
 
Future of Mobile Web - Coldfront conf
Future of Mobile Web - Coldfront confFuture of Mobile Web - Coldfront conf
Future of Mobile Web - Coldfront conf
Paul 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 2014
FalafelSoftware
 
Oscon 20080724
Oscon 20080724Oscon 20080724
Oscon 20080724
linkedin_resptest2
 
Rich Internet Applications (RIA) Web Testing
Rich Internet Applications (RIA) Web TestingRich Internet Applications (RIA) Web Testing
Rich Internet Applications (RIA) Web Testing
Mathias 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 IE7
goodfriday
 
Web components
Web componentsWeb components
Web components
Arvind Ravulavaru
 
4007655 introduction-to-javascript
4007655 introduction-to-javascript4007655 introduction-to-javascript
4007655 introduction-to-javascript
Vikash 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 everyone
Chris 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 Azure
Mahesh Dahal
 

What's hot (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
 

Viewers also liked

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
beyond tellerrand
 
Designing Socially Impactful Digital Experiences
Designing Socially Impactful Digital ExperiencesDesigning Socially Impactful Digital Experiences
Designing Socially Impactful Digital Experiences
Catt 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 Stocks
beyond 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 - #btconf
Christian 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 Web
Heiko Behrens
 
The Icon Design Process – Jon Hicks
The Icon Design Process – Jon HicksThe Icon Design Process – Jon Hicks
The Icon Design Process – Jon Hicks
beyond tellerrand
 
Chip Kidd - ! Or ? - btconfBER2015
Chip Kidd - ! Or ? - btconfBER2015Chip Kidd - ! Or ? - btconfBER2015
Chip Kidd - ! Or ? - btconfBER2015
beyond 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 2015
beyond 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 UX
stephtroeth
 
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
Scott Jenson
 
Imagining the physical web
Imagining the physical webImagining the physical web
Imagining the physical web
yiibu
 
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 Suda
beyond tellerrand
 
Designing Meaningful Animation
Designing Meaningful AnimationDesigning Meaningful Animation
Designing Meaningful Animation
Val 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
 
Atomic design
Atomic designAtomic design
Atomic design
Brad Frost
 
The Emerging Global Web
The Emerging Global WebThe Emerging Global Web
The Emerging Global Web
yiibu
 

Viewers also liked (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
 

Similar to 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 Practice
Zoe 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 II
Dirk Ginader
 
CSS 201
CSS 201CSS 201
CSS 201
Jennifer Berk
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorial
tutorialsruby
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorial
tutorialsruby
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorial
tutorialsruby
 
collapsible-panels-tutorial
collapsible-panels-tutorialcollapsible-panels-tutorial
collapsible-panels-tutorial
tutorialsruby
 
INTRODUCTIONS OF CSS PART 2
INTRODUCTIONS OF CSS PART 2INTRODUCTIONS OF CSS PART 2
INTRODUCTIONS OF CSS PART 2
SURYANARAYANBISWAL1
 
Look ma! No images!
Look ma! No images!Look ma! No images!
Look ma! No images!
Lennart Schoors
 
Css, xhtml, javascript
Css, xhtml, javascriptCss, xhtml, javascript
Css, xhtml, javascript
Trần Khải Hoàng
 
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 Conference
Rachel Andrew
 

Similar to 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
 

Recently uploaded

Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie WellsCollapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Rosie Wells
 
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
OECD Directorate for Financial and Enterprise Affairs
 
Carrer goals.pptx and their importance in real life
Carrer goals.pptx  and their importance in real lifeCarrer goals.pptx  and their importance in real life
Carrer goals.pptx and their importance in real life
artemacademy2
 
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdfWhy Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Ben Linders
 
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussionArtificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
Mẫu PPT kế hoạch làm việc sáng tạo cho nửa cuối năm PowerPoint
Mẫu PPT kế hoạch làm việc sáng tạo cho nửa cuối năm PowerPointMẫu PPT kế hoạch làm việc sáng tạo cho nửa cuối năm PowerPoint
Mẫu PPT kế hoạch làm việc sáng tạo cho nửa cuối năm PowerPoint
1990 Media
 
2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf
Frederic Leger
 
ASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdfASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdf
ToshihiroIto4
 
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdfBRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
Robin Haunschild
 
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
SkillCertProExams
 
Gregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics PresentationGregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics Presentation
gharris9
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
gpww3sf4
 
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
OECD Directorate for Financial and Enterprise Affairs
 
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
OECD Directorate for Financial and Enterprise Affairs
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
XP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to LeadershipXP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to Leadership
samililja
 
Burning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdfBurning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdf
kkirkland2
 

Recently uploaded (20)

Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie WellsCollapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie Wells
 
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
 
Carrer goals.pptx and their importance in real life
Carrer goals.pptx  and their importance in real lifeCarrer goals.pptx  and their importance in real life
Carrer goals.pptx and their importance in real life
 
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdfWhy Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
 
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussionArtificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
 
Mẫu PPT kế hoạch làm việc sáng tạo cho nửa cuối năm PowerPoint
Mẫu PPT kế hoạch làm việc sáng tạo cho nửa cuối năm PowerPointMẫu PPT kế hoạch làm việc sáng tạo cho nửa cuối năm PowerPoint
Mẫu PPT kế hoạch làm việc sáng tạo cho nửa cuối năm PowerPoint
 
2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf2024-05-30_meetup_devops_aix-marseille.pdf
2024-05-30_meetup_devops_aix-marseille.pdf
 
ASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdfASONAM2023_presection_slide_track-recommendation.pdf
ASONAM2023_presection_slide_track-recommendation.pdf
 
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdfBRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
BRIC_2024_2024-06-06-11:30-haunschild_archival_version.pdf
 
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...
 
Gregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics PresentationGregory Harris - Cycle 2 - Civics Presentation
Gregory Harris - Cycle 2 - Civics Presentation
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
 
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
Suzanne Lagerweij - Influence Without Power - Why Empathy is Your Best Friend...
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
 
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
 
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
 
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
 
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
 
XP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to LeadershipXP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to Leadership
 
Burning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdfBurning Issue Presentation By Kenmaryon.pdf
Burning Issue Presentation By Kenmaryon.pdf
 

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