[关闭]
@Wangww0925 2019-08-07T07:59:24.000000Z 字数 1268 阅读 226

stylus 语法

css预处理器


变量

css使用

  1. #box{
  2. width: 100%;
  3. height: 100%;
  4. font-size: 16px;
  5. }

stylus使用

  1. #box
  2. width: 100%
  3. height: 100%
  4. font-size: 16px

继承 @extend

css使用

  1. .fRSpace,
  2. #content{
  3. display: flex;
  4. flex-flow: row nowrap;
  5. justify-content: space-between;
  6. }
  7. #content{
  8. color: #333;
  9. }

stylus使用

  1. .fRSpace /*伸缩盒*/
  2. display: flex
  3. flex-flow: row nowrap
  4. justify-content: space-between
  5. #content
  6. @extend .fRSpace
  7. color: #333

定义函数 vendor()

css使用

  1. .btn{
  2. -webkit-border-radius: 5px;
  3. -moz-border-radius: 5px;
  4. -ms-border-radius: 5px;
  5. -o-border-radius: 5px;
  6. border-radius: 5px;
  7. }
  8. .bg{
  9. background: url("../img/16.jpg") no-repeat center center;
  10. background-size: contain;
  11. }

stylus使用

  1. /**
  2. * 半径
  3. * vendor('border-radius',5px)
  4. * vendor('box-shadow',0px 0px 1px 2px #333)
  5. * vendor('transform',translate(-50%,-50%))
  6. */
  7. vendor(prop, n)
  8. -webkit-{prop}:n
  9. -moz-{prop}:n
  10. -ms-{prop}:n
  11. -o-{prop}:n
  12. {prop}:n
  13. .btn
  14. vendor('border-radius',5px)
  15. /*背景图*/
  16. background(src,repeat,position,size)
  17. background:url(src) repeat position
  18. background-size:size
  19. .bg
  20. background("../img/16.jpg",no-repeat,center center,contain)

媒体 @media

css使用

  1. @media screen and (min-width: 769px) and (max-width: 992px){
  2. #app{
  3. width: 100%;
  4. background-color: red;
  5. }
  6. #box{
  7. display: hidden;
  8. }
  9. }

stylus使用

  1. @media screen and (min-width: 769px) and (max-width: 992px)
  2. #app
  3. width: 100%
  4. background-color: red
  5. .appTop
  6. display: hidden

作者 wendy
2018 年 12月 14日


参考文献

stylus
stylus参考文档

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注