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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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
Loading ..................

Console