Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                .container
  - 6.times do |i|
    %section{class: "lh"}
      %p 前端开发whqet,王海庆的技术博客,关注前端开发,分享相关资源,希望可以对您有所帮助。csdn专家博客http://blog.csdn.net/whqet和个人独立博客https://whqet.github.io同步更新,希望可以得到您的支持与肯定,您的支持是我最大的动力!王海庆,浙江邮电职业技术学院软件技术青椒一枚,其貌不扬、其名不翔,关心技术、热爱生活,我爱怒放的生命。
      
              
            
!

CSS

              
                /*一些变量*/
$lh:1.8em;
$colors: #9588DD #DD88C8 #D3DD88 #88B0DD #FFD86F #B4DB6C #0090FB #00965E;
/*布局和全局设置*/
.container{
  counter-reset:counterA;
}
.container section{
  counter-increment:counterA;
  position: relative;
  padding:10vh 20vw;
  background:#2B293D;
  border-bottom:1px dashed rgba(255,255,255,.1);
  &::before{
    content:counter(counterA);
    position: absolute;
    left:0;
    top:0;
    font-size:20vw;
    color:rgba(255,255,255,.05);
 }
 p{
   text-indent: 2em;
   line-height: $lh;
   color:#fff;
 }
}
/*第一个,彩色条纹,手动指定颜色*/
section:nth-of-type(1) {
  p {
    /*本案例仅仅兼容webkit内核浏览器*/
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: linear-gradient(
      to bottom,
      #9588DD,
      #9588DD $lh,
      #DD88C8 $lh,
      #DD88C8 $lh*2,
      #D3DD88 $lh*2,
      #D3DD88 $lh*3,
      #88B0DD $lh*3,
      #88B0DD $lh*4,
      #FFD86F $lh*4,
      #FFD86F $lh*5,
      #B4DB6C $lh*5,
      #B4DB6C $lh*6,
      #0090FB $lh*6,
      #0090FB $lh*7,
      #00965E $lh*7,
      #00965E
    );
  }
}
/*第二个,彩色条纹,mixins方式读取预设值*/
/**
 * $colors, 渐变颜色序列
 * $lh, 段落的行高
 *************************************************/
@function makestripes($colors,$lh){
  $stripes: 'to bottom, ';
  $i: 1;
  $l: length($colors);
  @each $color in $colors{
    $stripes: 
      $stripes + 
      $color + ' ' + ($lh * ($i - 1)) 
      + ',' + 
      $color + ' ' + ($lh * ($i * 1))
    ;
    @if ($i < $l){
      $stripes: $stripes + ',';
    }
    $i: $i + 1;
  }
  @return unquote('repeating-linear-gradient( ' + $stripes + ')');
}
section:nth-of-type(2) {
  p {
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: makestripes($colors,$lh);
  }
}
/*第三个,淡出效果,手动方式指定*/
section:nth-of-type(3) {
  p {
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: linear-gradient(
      to top,
      rgba(white, 0.2),
      rgba(white, 0.2) $lh,
      rgba(white, 0.4) $lh,
      rgba(white, 0.4) $lh*2,
      rgba(white, 0.6) $lh*2,
      rgba(white, 0.6) $lh*3,
      rgba(white, 0.8) $lh*3,
      rgba(white, 0.8));
    background-position: bottom center;
  }
}
/*第四个,淡出效果,mixins*/
@function makesFade($color:white,$lh:1.5em,$dir:'to top',$n:3){
  $stripes:$dir+", ";
  @for $i from 1 through $n{
    $stripes: 
      $stripes + 
      rgba($color,$i/$n) + ' ' + ($lh * ($i - 1)) 
      + ',' + 
      rgba($color,$i/$n) + ' ' + ($lh * ($i * 1));
    @if ($i < $n){
      $stripes: $stripes + ',';
    }
  }
  @return unquote('linear-gradient(' + $stripes + ')');
}
section:nth-of-type(4) {
  p {
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-image: makesFade(white,$lh,'to top',4);
  }
}
/*第五个,兼容其他浏览器*/
section:nth-of-type(5) {
  p{
    position: relative;
  }
  p::after{
    content:"";
    width:100%;
    height:100%;
    position: absolute;
    left:0;
    bottom:0;
    background-image: linear-gradient(
      to top,
      rgba(#2B293D, 1),
      rgba(#2B293D, 1) $lh,
      rgba(#2B293D, 0.8) $lh,
      rgba(#2B293D, 0.8) $lh*2,
      rgba(#2B293D, 0.6) $lh*2,
      rgba(#2B293D, 0.6) $lh*3,
      rgba(#2B293D, 0.4) $lh*3,
      rgba(#2B293D, 0.4) $lh*4,
      rgba(#2B293D, 0.2)
    );
    background-position: bottom center;
  }
}
/*第六个,兼容其他浏览器的mixins*/
@function makesFadeOther($color:white,$lh:1.5em,$dir:'to top',$n:3){
  $stripes:$dir+", ";
  @for $i from 1 through $n{
    $stripes: 
      $stripes + 
      rgba($color,1-$i/$n) + ' ' + ($lh * ($i - 1)) 
      + ',' + 
      rgba($color,1-$i/$n) + ' ' + ($lh * ($i * 1));
    @if ($i < $n){
      $stripes: $stripes + ',';
    }
  }
  @return unquote('linear-gradient(' + $stripes + ')');
}
section:nth-of-type(6) {
  p{
    position: relative;
  }
  p::after {
    content:"";
    width:100%;
    height:100%;
    position: absolute;
    left:0;
    bottom:0;
    background-image: makesFadeOther(#2B293D,$lh,'to top',4);
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console