scss dropdown.scss

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss dropdown.scss相关的知识,希望对你有一定的参考价值。

@mixin drop-down($background: #fff, $textColor: #000, $borderColor: #ccc) {
  display: inline-block;
  border: none;
  position: relative;
  background-color: $background;
  margin-right: 23px;
  > span {
    color: $textColor;
    padding: 12px 42px 12px 15px;
    font-size: 16px;
    display: block;
    cursor: pointer;
    border: 1px solid $borderColor;
    transition: color .2s ease-in-out;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    &:after, &:before {
      right: 12px;
      top: 31px;
      border: solid transparent;
      content: " ";
      height: 0;
      width: 0;
      position: absolute;
      pointer-events: none;
    }
    &:after {
      border-color: rgba(84, 89, 91, 0);
      border-top-color: $background;
      border-width: 5px;
      margin-top: -9px;
      right: 13px;
    }
    &:before {
      border-color: rgba(255, 255, 255, 0);
      border-top-color: $borderColor;
      border-width: 6px;
      margin-top: -8px;
    }
  }
  &:hover {
    > span {
      color: darken($color, 20%);
    }
  }
  ul {
    display: none;
    padding-left: 0;
    position: absolute;
    background: $background;
    z-index: 200;
    width: 100%;
    border: 1px solid $borderColor;
    padding-top: 4px;
    padding-bottom: 4px;
    margin: 0;
    list-style: none;
    li {
      a {
        color: #000;
        text-decoration: none;
        display: inline-block;
        padding-left: 15px;
        padding-right: 12px;
        padding-top: 4px;
        padding-bottom: 4px;
      }
    }
  }
  &.open {
    > span {
      &:after, &:before {
        right: 12px;
        top: 28px;
      }
      &:after {
        border-color: rgba(84, 89, 91, 0);
        border-bottom-color: $background;
        border-width: 5px;
        margin-top: -9px;
        right: 13px;
      }
      &:before {
        border-color: rgba(255, 255, 255, 0);
        border-bottom-color: $borderColor;
        border-width: 6px;
        margin-top: -12px;
      }
    }
    ul {
      display: block;
    }
  }
}

以上是关于scss dropdown.scss的主要内容,如果未能解决你的问题,请参考以下文章

scss scss_vertical-center.scss

scss scss_sass_if.scss

scss scss_sass创建-classes.scss

scss 修复基础bug基金会scss基础_functions.scss

导入基本部分 scss 时避免复制 [重复]

分离 SCSS 和 CSS 文件