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

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

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="container">
  <h1 class="row skew-title">  
    <span>S</span><span>K</span><span>E</span><span>W</span><span>E</span><span class="last">D</span>
    &nbsp; 
    <span>T</span><span>E</span><span>X</span><span class="last">T</span>
    &nbsp;
    <span class="alt">C</span><span class="alt">S</span><span class="alt">S</span><span class="alt last">3</span>
  </h1>
  <p class="row row--intro">Add some depth to page titles with CSS3 'SkewY' transform and optional JS hover.</p>
</div>
            
          
!
            
              skew-angle = 15deg
default-bg = darken(#2896d7, 40%)
alt-bg     = darken(#f06826, 20%)
alt-bg     = darken(#c82672, 10%)
alt-bg     = darken(desaturate(#f65429, 33%), 20%)
panel-x    = 40px
panel-y    = 50px
contrast   = 15%

body
  margin-top: 180px
  background-color: #112
  background-color: darken(#2896d7, 70%)
  font-family: Roboto, 'helvetica neue', Helvetica, Arial, sans-serif

.container
  width: 800px
  margin: auto

.row
  position: relative
  height: 50px  
  z-index: 1
  clear: both
  margin-bottom: 30px
  text-align: center

.row--intro
  padding-top: 20px  
  font-size: 16px
  line-height: 28px
  font-weight: 300
  color: #fff
  opacity: 0.4

  span
    font-size: 11px

.skew-title
  font-size: (panel-y / 2)

.skew-title span
  position: relative  
  display: inline-block  
  width: panel-x
  height: panel-y
  margin: auto
  z-index: 2
  text-align: center
  color: #fff
  font-family: 'roboto condensed'
  font-weight: 700
  font-size: (panel-y / 1.4) 
  line-height: panel-y 
  transform: skewY(-(skew-angle))
  transform-origin: 0 100%
  transition: all 0.2s
  cursor: default
    
  &:after,
  &:before
    display: block
    top: 0
    left: 0
    width: panel-x
    height: panel-y
    position: absolute
    background: default-bg
    content: ' '
    z-index: -1
    transition: all 0.2s
    
  &:before
    background: rgba(0,0,0,0.1)
    transform: skewY((skew-angle))
    transform-origin: 0 0
  
  &:nth-child(even)
    background-color: darken(default-bg, contrast)
    transform: skewY(skew-angle)
    transform-origin: 100% 100%
    color: darken(#fff, contrast)
    
    &:after
      background-color: darken(default-bg, contrast)
    
    &:before
      transform-origin: 100% 0
      transform: skewY(-(skew-angle))
  
  &.flat
    transform: skewY(0)
    color: #fff
    &:before
      transform: skewY(0)  
    &:nth-child(even) 
      &:after
        background-color: default-bg
   
  &.alt
    &:after
      background-color: alt-bg
    &:nth-child(even)
      &:after
        background-color: darken(alt-bg, contrast)
    &.flat
      &:nth-child(even)
        &:after
          background-color: alt-bg
      
      
            
          
!
            
              # We must use JS as we need to select previous
# elements which can't be done with CSS.

$('.skew-title').children('span').hover (->
  $el = $(this)
  n = $el.index() + 1
  $el.addClass 'flat'
  if n % 2 is 0
    $el.prev().addClass 'flat'
  else
    unless $el.hasClass 'last'
      $el.next().addClass 'flat'
), ->
  $('.flat').removeClass 'flat'

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

Console