[SCSS] Organize Styles with SCSS Nesting and the Parent Selector
SCSS nesting can produce DRYer code by targeting child elements without having to write the parent class. Nesting up to 3 levels deep can help us understand relationships between styles. The SCSS parent selector represents the parent class, so it can DRY up targeting pseudo-elements/classes and be an asset for naming conventions.
.box { &-container { /* .box-container, & --> .box*/
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
} transition: all 0.8s ease-in-out;
&:hover {
background-color: #ff4d4d;
transform: rotate(360deg);
}
background-color: #5fb3ce;
border: 1px solid burlywood;
font-size: 1.5em;
width: 200px;
height: 200px;
}
To css:
.box {
transition: all 0.8s ease-in-out;
background-color: #5fb3ce;
border: 1px solid burlywood;
font-size: 1.5em;
width: 200px;
height: 200px; }
.box-container {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh; }
.box:hover {
background-color: #ff4d4d;
transform: rotate(360deg); }
[SCSS] Organize Styles with SCSS Nesting and the Parent Selector的更多相关文章
- [SCSS] Organize SCSS into Multiple Files with Partials
Tired of dealing with monolithic CSS files? Are requests for multiple CSS files hurting your perform ...
- vue项目安装scss,以及安装scss报错(this.getResolve is not a function)
1.安装scss: npm install node-sass sass-loader vue-style-loader --save-dev //安装node-sass sass-loader vu ...
- [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 ...
- [SCSS] Reuse Styles with the SCSS @mixin Directive
Copy/pasting the same code is redundant and updating copy/pasted code slows development velocity. Mi ...
- [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 someth ...
- 如何在 SCSS 使用 JavaScript 变量/scss全局变量
Update2019/3/6:发现一个更好的方法,预处理器加载一个全局设置文件 官方github给出了详细的配置. 在 SCSS 中使用变量很方便,创建一个 variables.scss 文件,里面声 ...
- react layout init
class Layout extends React.Component { constructor(props) { super(props); } render() { return ( < ...
- 【转】手摸手,带你用vue撸后台 系列四(vueAdmin 一个极简的后台基础模板)
前言 做这个 vueAdmin-template 的主要原因是: vue-element-admin 这个项目的初衷是一个vue的管理后台集成方案,把平时用到的一些组件或者经验分享给大家,同时它也在不 ...
- element-ui的table表格控件表头与内容列不对齐问题
原文链接:点我 element-ui的table表格控件表头与内容列不对齐问题 解决方法:将以下样式代码添加到index.html.或app.vue中(必须是入口文件,起全局作用!)body .el- ...
随机推荐
- POJ 1874 畅通工程续(最短路模板题)
畅通工程续 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- Android学习之图片压缩,压缩程度高且失真度小
曾经在做手机上传图片的时候.直接获取相机拍摄的原图上传,原图大小一般1~2M.因此上传一张都比較浪费资源,有些场景还须要图片多张上传,所以近期查看了好多前辈写的关于图片处理的资料.然后试着改了一个图片 ...
- 1.1 Introduction中 Topics and Logs官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Topics and Logs 话题和日志 (Topic和Log) Let's fi ...
- FreeMarker template error: The following has evaluated to null or missing
使用freemarker前端分页,报错: FreeMarker template error: The following has evaluated to null or missing 后端直接赋 ...
- 洛谷 P1157 组合的输出
P1157 组合的输出 题目描述 排列与组合是常用的数学方法,其中组合就是从n个元素中抽出r个元素(不分顺序且r<=n),我们可以简单地将n个元素理解为自然数1,2,…,n,从中任取r个数. 现 ...
- [Angular] Protect The Session Id with https and http only
For the whole signup process. we need to Hash the password to create a password digest Store the use ...
- poj 3122
Pie Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10309 Accepted: 3651 Special Ju ...
- amazeui学习笔记--css(常用组件7)--输入框组Input-group
amazeui学习笔记--css(常用组件7)--输入框组Input-group 一.总结 1.使用:Input group 基于 Form 组件和 Button 组件扩展,依赖这两个组件.在容器上添 ...
- Javascript和jquery事件--阻止事件冒泡和阻止默认事件
阻止冒泡和阻止默认事件—js和jq相同,jq的event是一个全局的变量 我们写代码的时候常用的都是事件冒泡,但是有的时候我们并不需要触发父元素的事件,而浏览器也有自己的默认行为(表单提交.超链接跳转 ...
- JS学习笔记 - 点击、回车、ctrl+回车提交留言
疑点: oTxt1.onkeydown = function (ev) 为什么这里的onkeydown = function有变量 (ev),前面onclick函数没有? window.onload ...