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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <svg width='0' height='0'>
  <clipPath id="clippingTop">
    <polygon points="600,300 0,300 0,300 600,600">
    </polygon>
  </clipPath>
  <clipPath id="clippingBottom">
    <polygon points="0,00 600,300 600,300 0,300">
    </polygon>
  </clipPath>
  <clipPath id="clippingRight">
    <polygon points="0,0 600,300 600,300 0,600">
    </polygon>
  </clipPath>
  <clipPath id="clippingLeft">
    <polygon points="600,0 0,300 0,300 600,600">
    </polygon>
  </clipPath>
  <clipPath id="clippingLeftHover">
    <polygon points="600,0 0,300 0,300 600,600">
      <animate begin="elementLeftHover.mouseover" attributeName="points" to="600,0 0,0 0,600 600,600" dur="0.2s" fill="freeze" />
      <animate begin="elementLeftHover.mouseout" attributeName="points" to="600,0 0,300 0,300 600,600" dur="0.2s" fill="freeze" />
    </polygon>
  </clipPath>
  <clipPath id="clippingRightHover">
    <polygon points="0,0 600,300 600,300 0,600">
      <animate begin="elementRightHover.mouseover" attributeName="points" to="0,0 600,0 600,600 0,600" dur="0.2s" fill="freeze" />
      <animate begin="elementRightHover.mouseout" attributeName="points" to="0,0 600,300 600,300 0,600" dur="0.2s" fill="freeze" />
    </polygon>
  </clipPath>
</svg>
<div id="wrapper">
  <div class="topElement">
    <div class="title">
      Header
    </div>
  </div>
  <div class="elementRight">
    <div class="title">
      Triangles
    </div>
    <div class="text">
    Just some experimenting with SVG and clipPath. Works in any browser except IE, Edge or Firefox (the latter only partially).
    </div>
    <div class="overlayRight">
    </div>
  </div>
  <div class="elementLeft">
    <div class="title">
      Problem
    </div>
    <div class="text">
      The problem with clipPath in FireFox is that FF only accepts clipPath from a URL, which makes animating difficult. It works partially.
    </div>
    <div class="overlayLeft">
    </div>
  </div>
  <div class="elementRight">
    <div class="title">
      Problem
    </div>
    <div class="text">
      Firefox also only accepts px, not %, so making it responsive is hard.
    </div>
    <div class="overlayRight">
    </div>
  </div>
  <div class="elementLeft">
    <div class="title">
      IE & Edge
    </div>
    <div class="text">
      They simply don't support clipPath in any way. But who expected that? Neither does Opera Mini, but who uses that?
    </div>
    <div class="overlayLeft">
    </div>
  </div>
  <div class="elementRight">
    <div class="title">
      Future
    </div>
    <div class="text">
      I might pick up this project again in the future, to make it work on Firefox as well, but no promises!
    </div>
    <div class="overlayRight">
    </div>
  </div>
  <div class="elementLeft">
    <div class="title">
      TITLE
    </div>
    <div class="text">
      Tincidunt a scelerisque odio tincidunt porttitor, turpis lorem nec pid, vel lorem. Magna nunc adipiscing? Odio, proin diam magna a, enim elit adipiscing et?
    </div>
    <div class="overlayLeft">
    </div>
  </div>
  <div class="elementRight">
    <div class="title">
      TITLE
    </div>
    <div class="text">
      Tincidunt a scelerisque odio tincidunt porttitor, turpis lorem nec pid, vel lorem. Magna nunc adipiscing? Odio, proin diam magna a, enim elit adipiscing et?
    </div>
    <div class="overlayRight">
    </div>
  </div>
  <div class="elementLeft">
    <div class="title">
      TITLE
    </div>
    <div class="text">
      Tincidunt a scelerisque odio tincidunt porttitor, turpis lorem nec pid, vel lorem. Magna nunc adipiscing? Odio, proin diam magna a, enim elit adipiscing et?
    </div>
    <div class="overlayLeft">
    </div>
  </div>
  <div class="bottomElement">
    <div class="title">
      Made by 
    </div>
    <div class="text">
      Robbert Vervuurt<br />
      Twitter: <a href="https://twitter.com/rvervuurt">@rvervuurt</a>
    </div>
  </div>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Slabo+27px|Montserrat);

html,
body {
  background: url(http://subtlepatterns2015.subtlepatterns.netdna-cdn.com/patterns/dark_embroidery.png);
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
}

#wrapper {
  width: 600px;
  margin: auto;
}

.text {
  font-family: 'Slabo 27px', serif;
  line-height: 1.5em;
  font-size: 1.4em;
  color: #fff;
}

.title {
  font-family: 'Montserrat', serif;  
  font-size: 2em;
  color: #fff
}

.topElement {
  position: relative;
  margin-top: -20px;
  height: 300px;
  background: #232323;
  -webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 0%, 100% 100%);
  clip-path: url("#clippingTop");
  transition: all .2s;
}

.topElement .title {
  float: right;
  margin-top: 40px;
  margin-right: 40px;
}

.elementRight .title {
  position: relative;
  z-index: 1001;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  letter-spacing: 3px;
  margin-left: 40px;
  top: 160px;
  transition: all .2s;
}

.elementRight .text {
  position: relative;
  width: 40%;
  z-index: 1001;
  color: #fff;
  top: 180px;
  margin-left: 40px;
  transition: all .2s;  
}

.elementLeft .title {
  position: relative;
  z-index: 1001;
  color: #fff;
  letter-spacing: 3px;
  float: right;
  margin-right: 40px;
  top: 160px;
  font-size: 2em;
  transition: all .2s;
}

.elementLeft .text {
  position: absolute;
  text-align: right;
  width: 40%;
  z-index: 1001;
  color: #fff;
  top: 220px;
  right: 40px;
  transition: all .2s;  
}

a {
  color: #fff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.bottomElement .text {
  color: #fff;
  position: relative;
  margin-left: 40px;
  top: 150px;
}

.bottomElement .title {
  color: #fff;
  position: relative;
  margin-left: 40px;
  top: 130px;
}

.overlayRight {
  height: 100%;
  width: 100%;
  background: rgba(223,193,52,.6);
  position: absolute;
  top: 0;
  transition: all .2s;
  -webkit-clip-path: polygon(0% 0%, 100% 50%, 100% 50%, 0% 100%);
}

.overlayLeft {
  height: 100%;
  width: 100%;
  background: rgba(155,98,24,.6);
  position: absolute;
  top: 0;
  transition: all .2s;
  -webkit-clip-path: polygon(100% 0%, 0% 50%, 0% 50%, 100% 100%);
}

.elementRight {
  margin-top: -300px;
  height: 600px;
  background: url(https://scontent-ams2-1.cdninstagram.com/hphotos-xaf1/t51.2885-15/s640x640/sh0.08/e35/12276961_915583048496715_1399688203_n.jpg);
  -webkit-clip-path: polygon(0% 0%, 100% 50%, 100% 50%, 0% 100%);
  clip-path: url(#clippingRight);
  transition: all .2s;
  position: relative;
  opacity: .99;
}

.elementRight:hover {
  -webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  z-index: 1000;
  clip-path: url(#clippingRightHover);
}

.elementRight:hover .overlayRight, .elementRight:hover .title, .elementRight:hover .text {
  opacity: 0;
  -webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
}

.elementLeft:hover .overlayLeft, .elementLeft:hover .title, .elementLeft:hover .text {
  opacity: 0;
  -webkit-clip-path: polygon(100% 0%, 0% 0%, 0% 100%, 100% 100%);
}

.elementLeft {
  position: relative;
  margin-top: -300px;
  height: 600px;
  background: url(https://scontent-ams2-1.cdninstagram.com/hphotos-xtp1/t51.2885-15/s640x640/sh0.08/e35/12331447_180582838957044_760298558_n.jpg);
  -webkit-clip-path: polygon(100% 0%, 0% 50%, 0% 50%, 100% 100%);
  clip-path: url(#clippingLeft);
  transition: all .2s;
}

.elementLeft:hover {
  -webkit-clip-path: polygon(100% 0%, 0% 0%, 0% 100%, 100% 100%);
  z-index: 1000;
  clip-path: url(#clippingLeftHover);
}

.bottomElement {
  margin-top: -300px;
  height: 300px;
  background: #ecba44;
  -webkit-clip-path: polygon(0% 0%, 100% 100%, 100% 100%, 0% 100%);
  clip-path: url("#clippingBottom");
  transition: all .2s;
  position: relative;
}


              
            
!

JS

              
                $('.elementLeft').hover(function() {
	$(this).attr('id', 'elementLeftHover');
});

$('.elementLeft').mouseleave(function() {
	$(this).attr('id', '');
});

$('.elementRight').hover(function() {
	$(this).attr('id', 'elementRightHover');
});

$('.elementRight').mouseleave(function() {
		$(this).attr('id', '');
});

//var displayWidth = $('body').innerWidth(); // Needed for future FF-fix
              
            
!
999px

Console