scss的初级学习随笔小计
$white: #fff;
$three: #333;
$six: #666;
$nine: #999;
$red: #fff;
$orange: #f63;
$yellow: #fc0;
$opcity: rgba(255, 255, 255, 0);
/*定义一个宽高的混入box加了单位就是本来的单位不加单位会默认加上px*/
/*整体框架的思路是先判断传入是几个数每个数有每个数的规则*/
/*然后判断传入的数有没有单位如果没有单位会默认加上设定好的px*/
/*如果有单位则使用加上的单位*/
/*使用私有变量不使用全局变量*/
@mixin box($wides){
$list: width height line-height bordius;
@if length($wides) == 1{
@if unitless(nth($wides, 1)) {
#{nth($list, 1)}: 1px * nth($wides, 1);
}
@else {
#{nth($list, 1)}: nth($wides, 1);
}
}
@else if length($wides) ==2 {
@if unitless(nth($wides, 1)) {
#{nth($list, 1)}: 1px * nth($wides, 1);
#{nth($list, 2)}: 1px * nth($wides, 2);
}
@else {
#{nth($list, 1)}: nth($wides, 1);
#{nth($list, 2)}: nth($wides, 2);
}
}
@else if length($wides) ==3 {
@if unitless(nth($wides, 1)) {
#{nth($list, 1)}:1px * nth($wides, 1);
#{nth($list, 2)}:1px * nth($wides, 2);
#{nth($list, 3)}:1px * nth($wides, 3);
}
@else {
#{nth($list, 1)}: nth($wides, 1);
#{nth($list, 2)}: nth($wides, 2);
#{nth($list, 3)}: nth($wides, 3);
}
}
@else if length($wides) ==4{
@if unitless(nth($wides, 1)) {
#{nth($list, 1)}:1px * nth($wides, 1);
#{nth($list, 2)}:1px * nth($wides, 2);
#{nth($list, 3)}:1px * nth($wides, 3);
#{nth($list, 4)}:1px * nth($wides, 4);
}
@else {
#{nth($list, 1)}: nth($wides, 1);
#{nth($list, 2)}: nth($wides, 2);
#{nth($list, 3)}: nth($wides, 3);
#{nth($list, 4)}: nth($wides, 4);
}
}
} /*定义一个绝对定位的混入box-move无需加单位*/
@mixin box-move($x, $y) {
@if unitless($x) {
$x: 1px * $x;
}
@if unitless($y) {
$y: 1px * $y;
}
position: absolute;
top: $x;
left: $y;
}
/*定义一个图片路径的混入bg*/
@mixin bg1($location){
background: url('../images/#{$location}');
}
/*定义一个图片路径的混入不平铺左中心定位*/
@mixin bg2($location){
background: url('../images/#{$location}') no-repeat left center;
}
body {
@include bg1('bg.jpg')
} header {
@include box(1200 566);
margin: auto;
position: relative;
.logo-1 {
@include box(164 60);
@include bg1('header-logo1.png');
margin-top: 50px;
}
.logo-2 {
@include box(610 194);
@include box-move(200, 50);
@include bg1('header-logo2.png');
}
.logo-3 {
@include box(480 216);
@include box-move(200, 754);
@include bg1('header-logo3.png');
}
.logo-4 {
@include box(130 102);
@include box-move(440, 960);
/*使用混入背景的时候空格后面可以添加需要的样式*/
@include bg2('header-logo4.png');
padding-left: 110px;
text-align: left;
margin-right: 10px;
font-size: 18px;
em {
font-weight: normal;
color: $three;
display: inline-block;
padding-top: 4px;
}
p {
margin-top: 10px;
line-height: 20px;
font-size: 12px;
color: $six;
}
}
} nav {
@include bg1('nav-bg.jpg');
ul {
@include box(1200);
margin: auto;
font-size: 0;
text-align: center;
.nav-1 {
@include box(90);
background: none;
}
li {
@include box(150 76);
@include bg2('list-logo.png');
display: inline-block;
font-size: 18px;
text-align: right;
margin-right: 30px;
line-height: 76px;
font-weight: bold;
a {
color: $white;
&:hover {
color: $yellow;
font-size: 20px;
line-height: 74px;
}
}
}
}
}
scss的初级学习随笔小计的更多相关文章
- Kotlin 随笔小计
最近准备学Kotlin 现在Kotlin也能支持IOS开发了,准备后面买个Mac也能进行IOS开发 当然目标还是看着能不能把一些小的Android项目重构下 也算是定个目标吧,由于沉迷吃鸡,日志都没怎 ...
- MVC+EF 随笔小计——NuGet程序包管理
安装EF 打开 工具-库程序包管理器-程序包管理器控制台 输入 install-package entityframework 去MSDN上查看下EF的架构图:http://msdn.microsof ...
- MVC+EF 随笔小计——分部视图(Partial View)及Html.Partial和Html.Action差异
Partial View指可以应用于View中以作为其中一部分的View的片段(类似于之前的user control), 可以像类一样,编写一次, 然后在其他View中被反复使用. 一般放在" ...
- MVC+EF 随笔小计————Html Helpers
理论基础 -- Html Helpers 主要分成输入类和显示类. 输入类: TextArea, TextBox Password Hidden DropDownList ListBox (与Drop ...
- unicode随笔小计
科普字符集: ascii:一个字节,占8位,(0000 0000 - 1111 1111) 如果只是英语那就没什么问题. 后来,不同的语言有了编码诞生.为了统一,出现一个大集合.便有了. unicod ...
- linux 学习操作小计
屌丝最近在接触lamp开发 把工作中遇到的 问题和 一些常用的操作记下来.以便以后去翻阅 (1)linux下备份mysql数据库方法 #mysqldump -u root -p dbname > ...
- 【IOS实例小计】今日开贴,记录我的ios学习生涯,留下点滴,留下快乐,成荫后人。
今天开贴来记录自己的ios学习过程,本人目前小白一个,由于对ios感兴趣,所以开始学习,原职java程序,呵呵,勿喷. 本次的[ios实例小计]主要参考一文http://blog.sina.com.c ...
- 每日学习心得:SQL查询表的行列转换/小计/统计(with rollup,with cube,pivot解析)
2013-8-20 1. SQL查询表的行列转换/小计/统计(with rollup,with cube,pivot解析) 在实际的项目开发中有很多项目都会有报表模块,今天就通过一个小的SQL ...
- UWP学习记录7-设计和UI之控件和模式4
UWP学习记录7-设计和UI之控件和模式4 1.翻转视图 使用翻转视图浏览集合中的图像或其他项目(例如相册中的照片或产品详细信息页中的项目),一次显示一个项目. 对于触摸设备,轻扫某个项将在整个集合中 ...
随机推荐
- Qt入门之基础篇(三):掌握Qt4的静态编译基本方法
转载载请注明出处:CN_Simo. 导语: 前两章都提到过“静态编译”(Static Compilation),在Windows下一次静态编译差不多需要长达三个小时才能完成,而且还非常容易由于各种原因 ...
- 微软MSBI商业智能视频
第一讲:BI介质安装.BI基础知识讲解.BI方法论讲解.项目讲解 1.BI基础知识讲解.BI方法论实施2.微软BI的介绍(数据仓库介绍.SSIS介绍.SSAS介绍.SS ...
- webots自学笔记(一)软件界面和简单模型仿真
本人是某非理工类某高校大四狗,由于毕设研究需要使用webots软件,在学习使用webots的过程花费了很多时间.由于这个软件基本没有什么中文资料,所以想把自己所学到的一些东西写下来,如有什么错误的地方 ...
- Solr vs. Elasticsearch谁是开源搜索引擎王者
当前是云计算和数据快速增长的时代,今天的应用程序正以PB级和ZB级的速度生产数据,但人们依然在不停的追求更高更快的性能需求.随着数据的堆积,如何快速有效的搜索这些数据,成为对后端服务的挑战.本文,我们 ...
- 3360: [Usaco2004 Jan]算二十四
3360: [Usaco2004 Jan]算二十四 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 6 Solved: 6[Submit][Statu ...
- 免费瘫软入院,付费发飙成壮汉,YoMail 想干嘛?
大家好,我是YoMail 最近,Yo妹在思考一个非常严肃的事情. YoMail 全新升级,开启会员style! 新版叫Membership,即日就要与大家见面. 他的与众不同是推出"会员 ...
- 图解Javascript——作用域、作用域链、闭包
什么是作用域? 作用域是一种规则,在代码编译阶段就确定了,规定了变量与函数的可被访问的范围.全局变量拥有全局作用域,局部变量则拥有局部作用域. js是一种没有块级作用域的语言(包括if.for等语句的 ...
- C++数据
const :常量 ~x == -++x == -(x+1) 二进制数,1变为0,0变为1 ^ 相同为0,不同为1 & ...
- 用js控制css属性
在用js控制css属性时,行内css属性可以任意控制,但若是在<style></style>中写的css属性,均不能用alert读取,但是赋值却有几种现象, 第一种:无法读取, ...
- windows phone 8.1开发:磁铁|Tile更新
原文出自:http://www.bcmeng.com/tile/ 上一篇给大家分享了toast通知操作的方法,这一篇文章我们就来看windows phone 8.1开发中的磁铁更新.磁铁是window ...