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.翻转视图 使用翻转视图浏览集合中的图像或其他项目(例如相册中的照片或产品详细信息页中的项目),一次显示一个项目. 对于触摸设备,轻扫某个项将在整个集合中 ...
随机推荐
- SQL Server 2008R2 企业版 百度云下载地址
SQL Server 2008R2 (百度云下载地址:链接: http://pan.baidu.com/s/1mi34II8 密码: yc1w) ASP.NET MVC4.0+ WebAPI+Ea ...
- 【java基础之jdk源码】集合类
最近在整理JAVA 基础知识,从jdk源码入手,今天就jdk中 java.util包下集合类进行理解 先看图 从类图结构可以了解 java.util包下的2个大类: 1.Collecton:可以理解为 ...
- progID
ProgID程序员给CLSID指定的容易记住的名字ProgID命名约定:<Program>.<Component>.<Version>AppID:将某个APPID( ...
- 普实软件:MES机器数据维护
概述 机器数据有两个菜单,机器主数据在制造数据模块下,机器MES数据相关的设置在MES模块下,两个菜单查看的内容是一致的,但是机器主数据显示的是普通的机器,可做新增.编辑.删除操作,机器MES数据仅做 ...
- wemall app商城源码中基于JAVA通过Http请求获取json字符串的代码
wemall-mobile是基于WeMall的Android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.分享其中关于通过Http请求获取json字符串的代码供 ...
- 超出父视图无法点击问题hitTest
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #c91b13 } p.p2 { margin: 0.0px 0. ...
- Spring Boot启动过程(四):Spring Boot内嵌Tomcat启动
之前在Spring Boot启动过程(二)提到过createEmbeddedServletContainer创建了内嵌的Servlet容器,我用的是默认的Tomcat. private void cr ...
- UWP--页面传值
//匿名对象 private void Button1_OnClick(object sender, RoutedEventArgs e) { , name = "LBI" }); ...
- Android7.0 Phone应用源码分析(四) phone挂断流程分析
电话挂断分为本地挂断和远程挂断,下面我们就针对这两种情况各做分析 先来看下本地挂断电话的时序图: 步骤1:点击通话界面的挂断按钮,会调用到CallCardPresenter的endCallClicke ...
- python常见的特异点
编码问题 Python中默认的编码格式是 ASCII 格式,在没修改编码格式时无法正确打印汉字,所以在读取中文时会报错.解决方法为只要在文件开头加入 # -*- coding: UTF-8 -*- 或 ...