您当前的位置: 首页 > 

暂无认证

  • 3浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

SASS第一篇 认识它

发布时间:2020-08-03 00:09:06 ,浏览量:3

less以.less结尾. sass以.sass或者.scss结尾. 两种不同结尾方式区别: .sass结尾以缩进替代{}表示层级结构, 语句后面不用编写分号 .scss以{}表示层级结构, 语句后面需要写分号
                          企业开发中推荐使用.scss结尾
    注意点: 如果需要使用考拉编译sass文件, 项目目录结构中(包含文件名)不能出现中文和特殊字符 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> /*以下sass方式*/ /*@mixin 
		意思是代表可以使用@mixin这个语句的内容引用到多个选择器中.重复使用把.
		@include 指令可以将混入(mixin)引入到文档中。
		意思是可以将@mixin里面的语句引用到@include所在的地方.
		*/ /*下面是scss文件*/ /*mixin center{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.father{
  width: 300px;
  height: 300px;
  background: red;
  @include center;
  .son{
    width: 200px;
    height: 200px;
    background: blue;
    @include center;
  }
}*/ /*下面是scss编译成css代码的。*/ .father { width: 300px; height: 300px; background: red; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } .father .son { width: 200px; height: 200px; background: blue; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } </style> </head> <body> <div class="father"> <div class="son"></div> </div> </body> </html> 
关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.0489s