scss用法

他们是 CSS 预处理器。结构清晰,便于扩展。 可以方便地屏蔽浏览器私有语法差异。封装对浏览

器语法差异的重复处理, 减少无意义的机械劳动。 可以轻松实现多重继 承。 完全兼容 CSS 代

码,可以方便地应用到老项目中。LESS 只是在 CSS 语法上做了扩 展,所 以老的 CSS 代码也可

以与 LESS 代码一同编译。

1.1嵌套规则:

div {
  >nav{
      p,span{
          color: red;
          border: {
              style:solid;
              radius:20px;
              
          }
      }
  }
}

1.2父选择器&

a{
          color: red;
          &:hover{
              color: red;
              
          }

使用scss完成页面

header {
    width: 100%;
    height: 50px;
    background-color: #000;

    ul {
        width: 1200px;
        display: flex;
        justify-content: space-around;
        line-height: 50px;
        background-color: red;
        margin: 0 auto;
    }

    ul li {
        display: inline-block;
        text-align: center;
        width: 70px;

        &:hover {
            background-color: orange;
        }

        a {
            text-decoration: none;
            color: #fff;
        }
    }
}

article {
    width: 1200px;
    margin: 0 auto;

    ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    ul li {
        display: inline-block;
        width: 352px;
        height: 200px;
        margin-bottom: 20px;
        box-shadow: 10px 10px 5px #ccc;

        a {
            color: #000;
            text-decoration: none;
        

        img {
            width: 200px;
            height: 200px;
            float: left;
        }

        span {
            display: inline-block;
            width: 15px;
            height: 15px;
            background: url(../img/ico.png)  0 -99px ;
            background-size: 40px;
            

            &:hover {
                width: 15px;
                height: 15px;
                background: url(../img/ico.png) no-repeat -11px -74px;
            }
        }
    }
    }
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值