cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              .page
  h1 親の横幅に対して縦横比を固定したブロックを作ってみた
  p windowの幅に対してコンテンツが縦横比固定で縮尺する
  
  .shrinks
    .shrinks__item.shrink
      .shrink__inner
        img.shrink__content(src="http://placekitten.com/g/400/400")
    .shrinks__item.shrink
      .shrink__inner
        img.shrink__content(src="http://placekitten.com/g/400/700")
    .shrinks__item.shrink
      .shrink__inner
          img.shrink__content(src="http://placekitten.com/g/700/500")
    .shrinks__item.shrink
      .shrink__inner
        .shrink__content
           p 文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか文章とか
            
          
!
            
              @import "nib"

.page
  
  margin 0 auto
  width 90%

.shrinks
  width 80%
  &__item
    box-sizing border-box
    float left
    overflow hidden
    padding 10px
    width 50%
    
.shrink
  border-params = solid 1px #ccc
  border-top border-params
  border-right border-params
  
  &:nth-of-type(2n-1)
    border-left border-params
      
  &:nth-last-of-type(n-1)

    border-bottom border-params
  
  &:nth-of-type(-n+2)
    border-bottom none

  &__inner    
    overflow hidden
    position relative
    width 100%

    &:before
      content ''
      display block
      // http://www.w3.org/TR/CSS21/box.html
      // "The percentage is calculated with respect to the width of the generated box's containing block, even for 'padding-top' and 'padding-bottom'."
      // なのでpadding-topの値はコンテンツの"幅"基準で計算される
      padding-top 60%

  &__content
    absolute top 0 left 0 bottom 0 right 0
    margin auto
    width 100%

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console