css - 如何让我的 sass 登陆页面在 codepen 上运行?

标签 css import sass mixins codepen

这里三笔中有三个文件,我尝试将它们全部链接在一起,但仍然不起作用。我非常感谢您的帮助。

@import "reset";
@import "variables";
@import "mixins";

#main-nav{
  background: $deepBlue;
  ul{
    width: 100%;
  }
  li{
    float: left;
    width: (100% / 6);
    @include mQ(600px){
      width: 100%;
    }
  }
  a{
    color: $offWhite;
    text-decoration: none;
    padding: 16px;
    display: block;
    text-align: center;
    &:hover{
      background: lighten($deepBlue, 6);
    }
  }

  @include clearFix;
}

section h1{
  margin: 40px 0;
  text-align: center;
  text-transform: uppercase;
  color: $deepBlue;
  font-size: $sectionHeading;
}

#services{
  li{
    float: left;
    width: 33.33%;
    box-sizing: border-box;
    text-align: center;
  }
  img{
    width: 60%;
    margin: 20px 20%;
  }
  a{
    text-decoration: none;
    color: $deepBlue;
    font-weight: bold;
    &:hover{
      color: complement($deepBlue);
    }
  }
  @include clearFix;
  margin-bottom: 60px;
}

.lead-banner{
  @include banner;
  text-align: right;
}

.lessons-banner{
  @include banner;
  text-align: left;

  li{
    text-transform: uppercase;
    font-size: 20px;
    max-width: 500px;
    margin: 60px 0;
  }
}

#projects li{
  @include grid(6, 2%);
  img{
    width: 100%;
  }
}

这是变量.sccs 文件

$deepBlue: #032f3e;
$sectionHeading: 28px;
$offWhite: #f8f9fb;
$bannerHeading: 46px;

这里是 重置.scss文件

body {font-family: arial; background: #f8f9fb}
html, body, ul, ol, li, form, fieldset, legend
{
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6, p { margin-top: 0; }
fieldset,img { border: 0; }
li { list-style: none; }

.wrapper{
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

这是编译后的代码

@mixin banner{
  width: 100%;
  position: relative;
  color: white;
  .banner-content{
    position: absolute;
    top: 50px;
    width: 100%;
  }
  img{
    width: 100%;
  }
  span{
    font-size: $bannerHeading;
    display: block;
    text-transform: uppercase;
    font-weight: bold;
    @include mQ(3000px, 1200px){
      font-size: 68px;
    }
  }
  span.sub-title{
    font-weight: normal;
    margin-bottom: 30px;
  }
  @include mQ(1200px){
    max-height: 640px;
    overflow: hidden;
  }
}

@mixin clearFix{
  &:after{
    content: "";
    display: block;
    clear: both;
  }
}

@mixin grid($cols, $mgn){
  float: left;
  width: ((100% - (($cols - 1) * $mgn)) / $cols );
  margin-right: $mgn;
  margin-bottom: $mgn;
  &:nth-child(#{$cols}n){
    margin-right: 0;
  }
}

@mixin mQ($args...){
  @if length($args) == 1{
    @media screen and (max-width: nth($args, 1)){
      @content;
    }
  }
  @if length($args) == 2{
    @media screen and (max-width: nth($args, 1)) and (min-width: nth($args, 2)){
      @content;
    }
  }
}

这是我的笔的链接

https://codepen.io/nezmustafa123/pen/OpEBov

最佳答案

你必须在codepen的设置中导入你的文件,然后codepen导入它

关于css - 如何让我的 sass 登陆页面在 codepen 上运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43710827/

相关文章:

css - 如何在移动媒体查询中移动我的登录表单

javascript - 在同一目录中使用导入/导出两个 JavaScript 文件时遇到困难,不使用 React 或 Node

java - 为什么在我的 Maven 项目上组织导入会导致很多错误?

javascript - 组件选择器标签上的 Angular 2 样式?

javascript - JS 正则表达式替换 SCSS 中关闭花括号和打开类/id 之间的空行

html - 如何让下拉菜单覆盖其他元素

css - 如何跨越两个按钮的文本

javascript - Datepicker onSelect 格式化新的日期范围

sql - 将xml数据插入sql表

html - Clearfixing 漂浮在容器内但忽略漂浮在容器外?