[SCSS] Use Standard Built-in SCSS Functions for Common Operations
We can use javascript for color and opacity variations, math, list and map logic or to see if something exists. SCSS includes functions for a wide range of common use cases for logic in our styles. In this lesson we look at some of the more useful color functions to improve development velocity, readability, and simplify the code. Be sure to checkout all the SCSS functions: http://sass-lang.com/documentation/Sass/Script/Functions.html
$base: #24ea12;
$lighten_base: lighten($base, 25%);
$darken_base: darken($base, 25%); $clb: complement($base);
$cllb: complement($lighten_base);
$cldb: complement($darken_base); $light-color: scale_color($base, $alpha: -50%);
$dark-color: scale_color($base, $saturation: -35%); .base {
background-color: $base;
color: $clb;
} .lighten_base {
background-color: $lighten_base;
color: $cllb;
} .darken_base {
background-color: $darken_base;
color: $cldb;
} .linear-gradient {
background-image: linear-gradient($clb, $cllb, $cldb);
color: mix($base, yellow, 25%);
} .hover {
background-image: linear-gradient($base, $lighten_base, $darken_base);
color: mix($base, yellow, 25%);
&:hover {
color: transparentize(mix($base, yellow, 25%), .5); // based on given color, add 0.5 opacity
}
} .darken-color {
color: $dark-color;
} .lighten-color {
color: $light-color;
} .container {
display: grid;
grid-gap: 10px;
grid-template-columns: 1fr 1fr 1fr;
counter-reset: box;
height: 100vh;
} .box:before {
counter-increment: box;
font-size: 3em;
content: counter(box);
} .box {
display: flex;
justify-content: center;
align-content: center;
align-items: center;
}
[SCSS] Use Standard Built-in SCSS Functions for Common Operations的更多相关文章
- 在vue-cli中如何安装scss,并全局引入scss
在vue-cli脚手架采用scss正确的使用姿势 步骤一: 安装node-sass.sass-loader.style-loader npm install node-sass --save-dev ...
- [SCSS] Reuse Styles with the SCSS @mixin Directive
Copy/pasting the same code is redundant and updating copy/pasted code slows development velocity. Mi ...
- Standard C++ Programming: Virtual Functions and Inlining
原文链接:http://www.drdobbs.com/cpp/standard-c-programming-virtual-functions/184403747 By Josée Lajoie a ...
- [SCSS] Reuse Styles with the SCSS @extend Directive
We can write reusable styles with the SCSS @extend or @mixin directives. Which one is better? It dep ...
- 在vue项目中使用scss,以及vscode适配scss语法(解决使用scss语法编辑器报错)
项目搭建好之后 安装sass 依赖包 npm install --save-dev sass-loader //sass-loader依赖于node-sass npm install --save-d ...
- Data Types
原地址: Home / Database / Oracle Database Online Documentation 11g Release 2 (11.2) / Database Administ ...
- [SCSS] Write Custom Functions with the SCSS @function Directive
Writing SCSS @functions is similar to writing functions in other programming languages; they can acc ...
- css预编译语言 sass scss(变量$var, css嵌套规则,@import规则,@extend,@mixin)
什么是sass Sass 是对 CSS 的扩展,让 CSS 语言更强大.优雅. 它允许你使用变量.嵌套规则. mixins.导入等众多功能, 并且完全兼容 CSS 语法. Sass 有助于保持大型样式 ...
- Ruby安装Scss
Ruby安装Scss 引言 已经许久不写HTML了,今天有点以前的东西要改.但是刚装的Windows10,已经没有以前的Web开发环境了.只好重新安装. 结果Webstorm装好后配置Scss出现错误 ...
随机推荐
- 18.Node.js 事件循环
转自:http://www.runoob.com/nodejs/nodejs-tutorial.html Node.js 是单进程单线程应用程序,但是通过事件和回调支持并发,所以性能非常高. Node ...
- 在IE中opacity透明度
body{ background: red; opacity: 0.5; filter:alpha(opacity=50); } jQuery: if($.support.opacity == tur ...
- spring @configuration使用
http://yaobenzhang.blog.163.com/blog/static/2143951132014811105138824/
- 洛谷 P1755 斐波那契的拆分
P1755 斐波那契的拆分 题目背景 无 题目描述 已知任意一个正整数都可以拆分为若干个斐波纳契数,现在,让你求出n的拆分方法 输入输出格式 输入格式: 一个数t,表示有t组数据 接下来t行,每行一个 ...
- Hibernate之API初识及增删改查实现
声明:关于hibernate的学习.非常大一部分东西都是概念性的. 大家最好手里都有一份学习资料,在我的博文中.我不会把书本上的概念一类的东西搬过来.那没有不论什么意义.关于hibernate的学习, ...
- Android时间戳与字符串相互转换
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public cl ...
- php网站修改为https后curl报错301
今日测试项目时需调用post模拟传参测试接口是否可用,但返回报错信息(301永久迁移),在网上搜寻解决办法无果,最后发现只要将跳转地址修改为https://+url的形式就可以了
- time and datetime
一.简述 我们在写代码的过程经常遇到时间模块,如果我们以后需要根据时间去筛选信息的话,那用户会更大,所以今天就来讲讲时间的两大模块:time & datetime 二.time模块 1.tim ...
- 【干货】前端开发者最常用的六款IDE
一.Visual Studio Code 下载地址:https://code.visualstudio.com/ 功能介绍: 微软在2015年4月30日Build 开发者大会上正式宣布了 Visual ...
- Javascript和jquery事件--事件对象event
1. 事件对象event 对于event,js的解释是Event 对象代表事件的状态,比如事件在其中发生的元素.键盘按键的状态.鼠标的位置.鼠标按钮的状态.而jq的解释是事件处理(事件对象.目标元素 ...