$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. MINA、Netty、Twisted一起学(十二):HTTPS

    由于HTTPS协议是由HTTP协议加上SSL/TLS协议组合而成,在阅读本文前可以先阅读一下HTTP服务器和SSL/TLS两篇博文,本文中的代码也是由这两篇博文中的代码组合而成. HTTPS介绍 上一 ...

  2. 每天一个linux命令(40)--route命令

    Linux 系统的route 命令用于显示和操作IP路由表(show /manipulate the ip routing table).要实现两个不同的子网之间的通信,需要一台连接两个网络的路由器, ...

  3. 每天一个linux命令(33)--du命令

    Linux  du命令也是查看使用空间的,但是与 df  命令不同的是 Linux du 命令是对文件和目录磁盘使用的空间的查看,还是和df 命令有一些区别的. 1.命令格式: du  [选项] [文 ...

  4. 关于hosts文件的原理与制作

    由于需要整理的关于hosts的文件 关于hosts文件的原理与制作1.什么是hosts文件hosts文件是一个没有扩展名的系统文件,hosts文件用于存储计算机网络中节点信息的文件,它是可以将主机名映 ...

  5. Alamofire源码解读系列(四)之参数编码(ParameterEncoding)

    本篇讲解参数编码的内容 前言 我们在开发中发的每一个请求都是通过URLRequest来进行封装的,可以通过一个URL生成URLRequest.那么如果我有一个参数字典,这个参数字典又是如何从客户端传递 ...

  6. asp.net core mvc剖析:mvc动作选择

    一个http请求过来后,首先经过路由规则的匹配,找到最符合条件的的IRouter,然后调用IRouter.RouteAsync来设置RouteContext.Handler,最后把请求交给RouteC ...

  7. mongoDB & Nodejs 访问mongoDB (一)

    最近的毕设需要用到mongoDB数据库,又把它拿出来再学一学,下盘并不是很稳,所以做一些笔记,不然又忘啦. 安装 mongoDB & mongoVUE mongoDB: https://www ...

  8. C#:求100到200之前所有的质数和

  9. Compare Version Numbers leetcode

    Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 &l ...

  10. 每天一个Linux命令 7

    常用yum命令1)查询 yum list #查询所有可用软件包列表yum search 关键字 #搜索服务器上所有和关键字相关的包2)安装 yum -y install 包名选项: install 安 ...