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

              
                <div class="cup">
  <!-- カップの蓋 -->
  <div class="cup__top"></div>
  <!-- ストロー -->
  <div class="straw"></div>
  <div class="straw--bottom"></div>
  <!-- カップの中身 -->
  <div class="cup__inner-wrap">
    <div class="cup__inner-top"></div>
    <div class="cup__inner">
      <div class="tapioka tsubu-1"></div>
      <div class="tapioka tsubu-2"></div>
      <div class="tapioka tsubu-3"></div>
      <div class="tapioka tsubu-4"></div>
      <div class="tapioka tsubu-5"></div>
      <div class="tapioka tsubu-6"></div>
      <div class="tapioka tsubu-7"></div>
      <div class="tapioka tsubu-8"></div>
    </div>
    <div class="cup__inner-bottom"></div>
  </div>
  <!-- カップの底 -->
  <div class="cup__bottom"></div>
</div>
              
            
!

CSS

              
                @mixin absolute($top:null, $right:null, $bottom:null, $left:null){
  position: absolute;
  @if $top != null{
    top: $top;
  }
  @if $right != null{
    right: $right;
  }
  @if $bottom != null{
    bottom: $bottom;
  }
  @if $left != null{
    left: $left;
  }
}
// @include absolute($top:0,$right:0);
// 指定しなければauto

body{
  background:#ffedab;
  padding:100px 0 0 120px;
}

%cup,.cup{
  //カップの台形
  position: relative;
  width: 120px;
  height: 200px;
  background: #fff;
  &:before{
    content: ' ';
    border-right: 20px solid #fff;
    border-bottom: 200px solid transparent;
    border-radius: 6px 0 0 0 ;
    @include absolute($top:0,$left:-20px);
  }
  &:after{
    content: ' ';
    border-left: 20px solid #fff;
    border-bottom: 200px solid transparent;
    border-radius:0 6px 0 0 ;
    @include absolute($top:0,$right:-20px);
  }
  //カップの底
  &__bottom{
    width: 120px;
    height: 40px;
    border-radius: 60px / 20px;
    background:#fff;
    @include absolute($bottom:-20px,$left:0);
  }
  //カップの蓋
  &__top{
    width: 170px;
    height: 30px;
    border-radius: 85px / 15px;//それぞれwidthとheightの半分
    background:#f5f5f5;
    z-index:5;
    @include absolute($top:5px,$left:-24px);
    &:before{
      content:' ';
      width:170px;
      height:13px;
      background:#f5f5f5;
      @include absolute;
    }
    &:after{
      @extend %cup__top;
      content:' ';
      background:#fff;
      top:-15px;
      left:0;
    }
  }

  //カップの中身を囲うラップ
  &__inner-wrap{
    @include absolute($bottom:0,$left:-40px);
  }
  //カップの中身の台形
  &__inner{
    width: 110px;
    height: 150px;
    background: #c49a6a;
    margin-left: 45px;
    position: relative;
    z-index:2;
    &:before{
      content: ' ';
      border-right: 15px solid #c49a6a;
      border-bottom: 150px solid transparent;
      border-radius: 3px 0 0 0 ;
      @include absolute($top:0,$left:-15px);
    }
    &:after{
      content: ' ';
      border-left: 15px solid #c49a6a;
      border-bottom: 150px solid transparent;
      border-radius:0 3px 0 0 ;
      @include absolute($top:0,$right:-15px);
    }
  }
  //カップの中身の上の楕円
  &__inner-top{
    width: 140px;
    height: 30px;
    background-color: #deb887;
    border-radius: 70px / 15px;
    z-index:3;
    @include absolute($top:-12px,$left:30px);
  }
  //カップの中身の下の楕円
  &__inner-bottom{
    width: 110px;
    height: 30px;
    border-radius: 55px / 15px;
    background-color: #c49a6a;
    z-index:1;
    @include absolute($top:134px,$left:45px);
  }
}

// ストロー
%straw,.straw{
  background:#ea5550;
  width:20px;
  height:70px;
  z-index:5;
  @include absolute($top:-70px,$left:50px);
  &:before{
    content:' ';
    width: 20px;
    height: 4px;
    background-color: #ea5550;
    border-radius: 10px / 2px;
    @include absolute($bottom:-2px);
  }
  &:after{
    @extend %straw:before;
   	background-color: #a73836;
    top:-2px;
  }
  &--bottom{
    @extend %straw;
    height:30px;
    top:30px;
    left:50px;
    z-index:4;
  }
}

.tapioka{
  position:absolute;
  width:20px;
  height:20px;
  border-radius:20px;
  background:#000;
}

.tsubu{
  &-1{
    bottom:4px;
    left:5px;
    animation: tsubu 1.2s ease-in-out infinite alternate;
  }
  &-2{
    bottom:-5px;
    left:28px;
    animation: tsubu 0.5s ease-in-out infinite alternate;
  }
  &-3{
    bottom:2px;
    left:55px;
    animation: tsubu 1s ease-in-out infinite alternate;
  }
  &-4{
    bottom:-2px;
    left:81px;
    animation: tsubu 0.6s ease-in-out infinite alternate;
  }
  &-5{
    bottom:34px;
    left:2px;
    animation: tsubu 0.8s ease-in-out infinite alternate;
  }
  &-6{
    bottom:25px;
    left:30px;
    animation: tsubu 0.7s ease-in-out infinite alternate;
  }
  &-7{
    bottom: 32px;
    left: 61px;
    animation: tsubu 0.9s ease-in-out infinite alternate;
  }
  &-8{
    bottom: 24px;
    left: 86px;
    animation: tsubu 1.1s ease-in-out infinite alternate;
  }
}

@keyframes tsubu {
  0% { transform:translateY(0px); }
100% { transform:translateY( 3px); }
}
              
            
!

JS

              
                
              
            
!
999px

Console