$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的初级学习随笔小计的更多相关文章

  1. Kotlin 随笔小计

    最近准备学Kotlin 现在Kotlin也能支持IOS开发了,准备后面买个Mac也能进行IOS开发 当然目标还是看着能不能把一些小的Android项目重构下 也算是定个目标吧,由于沉迷吃鸡,日志都没怎 ...

  2. MVC+EF 随笔小计——NuGet程序包管理

    安装EF 打开 工具-库程序包管理器-程序包管理器控制台 输入 install-package entityframework 去MSDN上查看下EF的架构图:http://msdn.microsof ...

  3. MVC+EF 随笔小计——分部视图(Partial View)及Html.Partial和Html.Action差异

    Partial View指可以应用于View中以作为其中一部分的View的片段(类似于之前的user control), 可以像类一样,编写一次, 然后在其他View中被反复使用. 一般放在" ...

  4. MVC+EF 随笔小计————Html Helpers

    理论基础 -- Html Helpers 主要分成输入类和显示类. 输入类: TextArea, TextBox Password Hidden DropDownList ListBox (与Drop ...

  5. unicode随笔小计

    科普字符集: ascii:一个字节,占8位,(0000 0000 - 1111 1111) 如果只是英语那就没什么问题. 后来,不同的语言有了编码诞生.为了统一,出现一个大集合.便有了. unicod ...

  6. linux 学习操作小计

    屌丝最近在接触lamp开发 把工作中遇到的 问题和 一些常用的操作记下来.以便以后去翻阅 (1)linux下备份mysql数据库方法 #mysqldump -u root -p dbname > ...

  7. 【IOS实例小计】今日开贴,记录我的ios学习生涯,留下点滴,留下快乐,成荫后人。

    今天开贴来记录自己的ios学习过程,本人目前小白一个,由于对ios感兴趣,所以开始学习,原职java程序,呵呵,勿喷. 本次的[ios实例小计]主要参考一文http://blog.sina.com.c ...

  8. 每日学习心得:SQL查询表的行列转换/小计/统计(with rollup,with cube,pivot解析)

    2013-8-20 1.    SQL查询表的行列转换/小计/统计(with  rollup,with cube,pivot解析) 在实际的项目开发中有很多项目都会有报表模块,今天就通过一个小的SQL ...

  9. UWP学习记录7-设计和UI之控件和模式4

    UWP学习记录7-设计和UI之控件和模式4 1.翻转视图 使用翻转视图浏览集合中的图像或其他项目(例如相册中的照片或产品详细信息页中的项目),一次显示一个项目. 对于触摸设备,轻扫某个项将在整个集合中 ...

随机推荐

  1. Linux的常用基本命令。

    Linux的常用基本命令. 首先启动Linux.启动完毕后需要进行用户的登录,选择登陆的用户不同自然权限也不一样,其中"系统管理员"拥有最高权限. 在启动Linux后屏幕出现如下界 ...

  2. input 即时搜索 监听输入值的变化

    在 Web 开发中经常会碰到需要动态监听输入框值变化的情况,如果使用 onkeydown.onkeypress.onkeyup 这个几个键盘事件来监测的话,监听不了右键的复制.剪贴和粘贴这些操作,处理 ...

  3. Git基础教程(二)

    继续上篇Git基础教程(一),在开篇之前,先回顾一下上篇中的基本命令. 配置命令:git config --global * 版本库初始化:git init 向版本库添加文件:git add * 提交 ...

  4. 【2017-03-10】Tsql语句基础、条件,高级查询

    一.语句基础 1.创建数据库:create database 数据库名(不能汉字,不能数字.符号开头) 2.删除数据库:drop database 数据库名 3.选用数据库:use 数据库名 4.创建 ...

  5. Nginx+IIS+Redis 处理Session共享问题 2

    接下来主要说下利用nginx来测试 两台Windows server 1.10.120.131.210 -  端口84部署demo 2.10.120.131.211 -  端口84部署demo ngi ...

  6. KoaHub.JS用于Node.js的可移植Unix shell命令程序代码

    shelljs Portable Unix shell commands for Node.js ShellJS - Unix shell commands for Node.js     Shell ...

  7. 1798: [Ahoi2009]Seq 维护序列seq

    1798: [Ahoi2009]Seq 维护序列seq Time Limit: 30 Sec  Memory Limit: 64 MBSubmit: 2930  Solved: 1087[Submit ...

  8. UI 基本控件使用

    一>UITextFiled  ———>UITextField是什么 UITextField ( 输入框 ) : 是控制文本输入和显示的控件.在APP中UITextField 出现频率很高 ...

  9. 关于在链路聚合下做smart,monitor link的转发测试

    关于在链路聚合下做smart,monitor link的转发测试 这次又要开始瞎折腾了.没事找事了.毕竟我还是很无聊的: 这个实验主要要涉及到以下几个方面: 1.gvrp的应用: 2.Smart Li ...

  10. 属性property和字段的区别

    在类中定义的一个成员变量叫字段,要把这个成员变量变成一个属性必须加上getter和setter方法