Rucksack 裝滿神奇 css 的後背包
-
Upload
anna-su -
Category
Engineering
-
view
222 -
download
2
Transcript of Rucksack 裝滿神奇 css 的後背包
A little bag of CSS superpowers
sparknotes
5
PostCSS ecosystem
crescendo
it's built on PostCSS
8
rucksack
Installation & Usagehttp://simplaio.github.io/rucksack/docs/#usage
Installation & Usage
postcss: function() {
return {
plugins: rucksack([autoprefixer])
};
}
webpack.config.js
PostCSS for Webpack
15
html {
font-size: calc(14px + 36 * ((100vw - 480px) / 320));
}
@media screen and (max-width: 480px) {
html {
font-size: 14px;
}
}
@media screen and (min-width: 800px) {
html {
font-size: 50px;
}
}
output
Responsive Typography
19
Shorthand Positioning
.box1 {
position: absolute 0;
}
.box2 {
position: relative 20% auto;
}
.box1 {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.box2 {
position: relative;
top: 20%;
right: auto;
bottom: 20%;
left: auto;
}
input output
22
Shorthand Positioning
.box3 {
position: fixed 0 20px 10px;
}
.box3 { position: fixed; top: 0; right: 20px; bottom: 10px; left: 20px;}
input output
23
Hex RGBA Shortcutsinput
output
background-color: rgba(#2196F3, 0.3);
background-color: rgba(33, 150, 243, 0.3);
25
Quantity Pseudo-Selectorsinput output
li&:at-least(5) {
color: blue;
}
li:nth-last-child(n+4),
li:nth-last-child(n+4) ~ li {
color: blue;
}
27
All The Easingsinput
output
transition: all 250ms ease-in-quint;
transition: all 250ms cubic-bezier(0.755, 0.05, 0.855, 0.06);
29
Referencerucksack https://simplaio.github.io/rucksack/
PostCSS: the Future after Sass and Less https://ai.github.io/about-postcss/en/
TJ Holowaychuk Github https://github.com/tj/frontend-boilerplate