$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. 用react分页显示数据

    去年年底,尝试着用react写个组件化的页面! demo地址 里面有一个list页面弄了一下数据的分页展示 展示一下主要三个组件:父组件listBox.列表组件List.按钮组件PageButton ...

  2. 不恰当的update语句使用主键和索引导致mysql死锁

    背景知识: 截至目前,MySQL一共向用户提供了包括DBD.HEAP.ISAM.MERGE.MyIAS.InnoDB以及Gemeni这7种Mysql表类型.其中DBD.InnoDB属于事务安全类表,而 ...

  3. HTTP基础知识(一)

    一.了解web及网络基础 1.通过发送请求获取服务器资源的web浏览器等的都可称为客户端(client) 2.HTTP:HyperText Transfer Protocol,超文本传输协议:所有的W ...

  4. maven 常用脚本

    Maven库: http://repo2.maven.org/maven2/ Maven依赖查询: http://mvnrepository.com/ Maven常用命令: 1. 创建Maven的普通 ...

  5. 了解 : angular $filter stateful

    {{ abc | myFilter }} angular.module('myStatefulFilterApp', []) .filter('decorate', ['decoration', fu ...

  6. Nginx rewrite(重读)

    Nginx Rewrite规则相关指令  Nginx Rewrite规则相关指令有if.rewrite.set.return.break等,其中rewrite是最关键的指令.一个简单的Nginx Re ...

  7. Servlet的监听

    Servlet监听 在<Servlet和Jsp>中我们使用了ServletConfig获取Servlet的初始配置,用ServletContext来获取整个Web应用的初始配置,但如果需要 ...

  8. oracle数据库命令-持续更新

    一.系统命令 登录 dba用户命令 sqlplus / as sysdba 2. 用户命令 删除用户 DROP USER **** CASCADE; DROP SCHEMA **** CASCADE; ...

  9. ThinkPhp框架的数据库操作(查询)

    TP框架有一套自己的数据库操作的代码,包括数据库的增.删.改.查.本文主要讲解TP框架的数据库查询操作. 找到入口文件的控制器: 我这里的入口文件是Show文件夹下的控制器. 打开Login控制器. ...

  10. 用TTL线在CFE环境下拯救半砖wrt54g路由器

    缘起:路由器被刷成半砖 Linksys wrt54gs v4路由器,已刷入 tomato-dualwlan 1.23.使用数年,未出现任何故障. 在日用的wifi网络上,通过web界面刷入了错误的to ...