Fluid css value
Usage:
postcss([
require('postcss-fluid')({
min: '320px',
max: '1200px',
functionName: 'fluid',
}),
]);
[selector] {
...
[property]: *values* fluid([min], [max]) *values*;
...
}
Examples
Input
body {
padding: 1rem fluid(10px, 20px) 2rem;
font-size: fluid(16px, 30px);
}
Output
body {
padding: 1rem calc(10px + 10 * (100vw - 320px) / 880) 2rem;
font-size: calc(16px + 14 * (100vw - 320px) / 880);
}
@media (max-width: 320px) {
body {
padding: 1rem 10px 2rem;
font-size: 16px;
}
}
@media (min-width: 1200px) {
body {
padding: 1rem 20px 2rem;
font-size: 30px;
}
}