zoukankan      html  css  js  c++  java
  • sass进阶—函数

    /*内置函数*/

    /*1)常规的rgb,rgba函数*/
    $color:rgb(255,255,162);
    body{
    color: $color;
    background-color:rgba($color, 0.5);

    /*2)lighten,darken函数*/
    span{
    color: darken($color,0.4);//颜色加深0.4倍
    background-color: lighten($color,0.5);//颜色变浅0.5倍。
    }
    }

     


    /*str-length(),str-index() 下标是从1开始的而不是0*/
    $str:'beautiful';
    p{
    z-index: str-length($str);
    z-index: str-index($str,'f');
    }

    /*自定义function*/

    @function double($width){
    @return $width * 2;
    }

    a{
    double(10px);
    }


    /*@warn,@debug,@error 主要用于输出*/

    @debug 'this is a debug test';/*在控制台看结果*/
    @warn 'warn';


    /*实例:自定义一个函数,通过给定的层次,获取特定的z-index*/

    没有人能一路单纯到底,但是要记住,别忘了最初的自己!
  • 相关阅读:
    共享开发者账号
    IOS开发之关键字synchronized
    svn in xcode5
    Xcode5真机调试
    iOS autolayout
    ios正则表达式
    UITextView与UITextfield的区别
    MyBatis笔记(一)
    JAVA命名规则
    ORACLE SQL DEVELOPER配置
  • 原文地址:https://www.cnblogs.com/LindaBlog/p/10396420.html
Copyright © 2011-2022 走看看