5 October 2014. Zagreb, Croatia
… see more awesomeness at http://www.celtra.com/gallery/
<style>
p { height: 20px; }
p:empty { height: 0; }
</style>
Q: What’s the paragraph's height?
.modal-box {
width : 100px;
height : 200px;
background-color : #ll3377;
line-height : 20px;
overflow : hidden;
font : 10px Arial;
text-indent : 5px;
pointer-events : none;
}
Q: What’s the line height?
normal
font-family: Helvetica Neue;
font-family: monospace;
font-family: 'monospace';
font-family: Exo 2;
font-family: Exo \2;
font-family: €42;
More fun at https://mathiasbynens.be/notes/unquoted-font-family.
.calculator {
width : 200px;
height : 20px;
background-color : red;
}
.calculator:hover {
border : 1px solid white;
background-color : blue;
}
Hovering over .calculator
element requires style recalculation.
.calculator {
width : 200px;
height : 20px;
background-color : red;
}
.calculator:hover {
background-color : blue;
}
.calculator {
width : 200px;
height : 20px;
background-color : red;
}
.calculator:hover { }
@sedovsek @addyosmani it's not needed on {} , but that's an optimization we haven't made yet.
— Paul Irish (@paul_irish) October 3, 2014
are possible to achieve in completely different ways…
How would you name that class?
Nope! It's…
.big-red-title {
font-size: 3em;
color: red;
}
.big-red-title {
font-size: 10pt;
color: #bada55;
}
Develop your own set of rules and stick to them.
Document them, if needed.
:
in property declarations, {
,}
appears on its own line after the final property,Source: http://css-tricks.com/poll-results-how-do-you-order-your-css-properties/
.selector {
/* Positioning */
position, z-index, top, right, left, bottom
/* Disply and box properties */
display, overflow, box-sizing, width, height, margin, padding, border
/* Color */
background-color, color
/* Text Properties */
font-family, font-size, line-height, text-align, text-decoration
/* Other */
cursor, pointer-events, etc.
}
.modal-box {
width : 40%;
height : 200px;
background-color : #ll3377;
overflow : hidden;
box-shadox : 10px 10px 5px #bada55;
}
More about our CSS formatting: http://galjot.si/formatting-css.
Mixins would produce WET (Write everything twice)
Extends would produce DRY (Don’t repeat yourself)
Extends don’t accept parameters, mixins do.
npm install -g imageoptim-cli
npm install grunt-contrib-cssmin
npm install cssshrink
npm install -g uncss
npm install grunt-uncss --save-dev
npm install gulp-uncss --save-dev
Use continuous painting mode to track down elements and styles that add a lot of painting cost:
Profiling Long Paint Times with DevTools' Continuous Painting Mode
But what about visual 'correctness'?
“The technology is out there…
Now let's build some tools and
make them work for us.”