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="container">
  <header>
    <div class="layer1 header-layer">
      <div class="layer2 header-layer">
        <div class="layer3 header-layer">
          <div class="layer4 header-layer">
            <div class="layer5 header-layer">
            </div>
          </div>
        </div>
      </div>
    </div>
    <h1 class="title">背景用の図形を生成<span class="subtitle">generate background shape</span></h1>
  </header>
  
  <section>
    <h2>Cascading</h2>
    <div class="folder-container">
      <div class="folder1 folder">folder1</div>
      <div class="folder2 folder">folder2</div>
      <div class="folder3 folder">folder3</div>
      <div class="folder4 folder">folder4</div>
    </div>
    
    <pre><code class="css">.folder {
  _xcj_background: shape(
    outline: d(M0 10 L5 0 L45 0 L50 8 L100% 8
               L100% 100% L0 100% z)
  );
}

.folder1 {
  background: #f75;
}

.folder2 {
  background: #00AFFB;
}

.folder3 {
  background: #F4D100;
}

.folder4 {
  background: #31C73D;
}</code></pre>
  </section>
  
  <section>
    <h2>Polygon</h2>
    <div class="hexagon">Hexagon</div>
    
    <pre><code class="css">/* polygon(角の数, 半径, 中心点) */
.hexagon {
  _xcj_background: shape(
    outline: polygon(6, 230, 50%)
  );
}</code></pre>
  </section>
  
  <section>
    <h2>Corner shape</h2>
    <div class="corner-shape-section">
      <div class="curve cs-sample">curve</div>
      <div class="bevel cs-sample">bevel</div>
      <div class="notch cs-sample">notch</div>
      <div class="scoop cs-sample">scoop</div>
    </div>
    
    <pre><code class="css">/* corner-shape(形状, 半径) */
.curve {
  _xcj_background: shape(
    outline: polygon(3, 205, 50%, 50%+10),
    outline-filter: corner-shape(curve, 10)
  );
}

.bevel {
  _xcj_background: shape(
    outline: polygon(5, 175, 50%, 50%-5),
    outline-filter: corner-shape(bevel, 15)
  );
}

.notch {
  _xcj_background: shape(
    outline: polygon(4, 190, 50%),
    outline-filter: corner-shape(notch, 15)
  );
}

.scoop {
  _xcj_background: shape(
    outline-filter: corner-shape(scoop, 30)
  );
}</code></pre>
  </section>
  
  <section>
    <h2>Insert</h2>
    <div class="ribbon">No.1</div>
    
    <pre><code class="css">.ribbon {
  _xcj_background: shape(
    outline-filter: modify(+[3](L50% 100%-35))
  );
}</code></pre>
  </section>
  
  <section>
    <h2>Move</h2>
    <div class="arrow">Next..</div>
    
    <pre><code class="css">.arrow {
  _xcj_background: shape(
    outline-filter: modify(+[2](L100% 50%), [1]+=(-40 0), [2]+=(-40 0) )
                    corner-shape(curve, 8)
  );
}</code></pre>
  </section>
  
  <section>
    <h2>Remove and Replace</h2>
    <div class="mix">mix</div>
    
    <pre><code class="css">.mix {
  _xcj_background: shape(
    outline: polygon(12, 100%, 50%),
    outline-filter: modify( [2]=(Q73% 26%, 300 80), -[8], -[10] )
  );
}</code></pre>
  </section>
  
  <section>
    <h2>Elastic1</h2>
    <div class="solid-balloon" data-resize-min="230" data-resize-max="338">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </div>
    
    <pre><code class="css">.solid-balloon {
  _xcj_background: shape(
    outline: d(M10 30 L50 50 L20% 10 L60% 0 L100%-20 40
               L100%-10 60% L100%-50 100%-20 L40% 100% L70 100%-20
               L20 70% L40 80 z)
  );
}</code></pre>
  </section>
  
  <section>
    <h2>Elastic2</h2>
    <div class="braces" data-resize-min="250" data-resize-max="360">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </div>
    
    <pre><code class="css">.braces {
  _xcj_background: shape(
    outline: d(M40 0 C-10 5, 45 50%-15, 0 50% C45 50%+15, -10 100%-5, 40 100%
               M100%-40 0 C100%+10 5, 100%-45 50%-15, 100% 50% C100%-45 50%+15, 100%+10 100%-5, 100%-40 100%)
  );
}</code></pre>
  </section>
  
  <section>
    <h2>Elastic3</h2>
    <div class="fluffy" data-resize-min="240" data-resize-max="363">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </div>
    
    <pre><code class="css">.fluffy {
  _xcj_background: shape(
    outline: d(M40 30 C15% -20, 50% 30, 95% 10
               C80% 25%, 110% 80%, 82% 100%-10
               C60% 100%, 50% 90%, 10% 100%-5
               Q0 50% 40 30 z),
    outline-filter: corner-shape(curve, 50)
  );
}</code></pre>
  </section>
  
  
  <div class="resize-control">
    resize: <input type="range" />
  </div>
</div>

<!-- シンタックスハイライト -->
<script src="http://jsrun.it/assets/d/x/g/e/dxgek"></script>
<script>
    hljs.initHighlightingOnLoad();
</script>

              
            
!

CSS

              
                @font-face {
	font-family: 'dejima-mincho';
	src: url('') format('woff');
	font-weight: normal;
	font-style: normal;
}
/* dejima-fonts  https://code.google.com/p/dejima-fonts/
Copyright (c) 2005-2009 Yoshiki Hayashi <yoshiki@xemacs.org>
Released under the MIT license
https://opensource.org/licenses/mit-license.php
*/

html {
    background: #fff;    
}

body {
  font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", sans-serif;
  margin: 0 auto;
  width: 449px;
}

.container {
  overflow: hidden;
}

header {
  height: 465px;
  margin-bottom: 80px;
  overflow: hidden;
  text-align: center;
}

.title {
  box-sizing: border-box;
  color: #753;
  /* font-family: dejima-mincho; */
  font-size: 38px;
  position: absolute;
  top: 165px;
  width: 449px;
}

.subtitle {
  display: block; 
  font-size: 18px;
  font-weight: normal;
  line-height: 1;
}

.header-layer {
  _xcj_background: shape(
    outline: d(M231 57 Q361 231, 231 407 Q101 231 231 57 z)
  );
  height: 465px;
  opacity: 0;
  -webkit-transform: scale(1.2);
  transform: scale(1.2);
}

.header-layer:not(:first-of-type) {
  -webkit-transform: rotate(36deg);
  transform: rotate(36deg);
}

.layer1 {
  background: rgba(2,191,255,0.44);
}

.layer2 {
  background: rgba(101,0,170,0.30);
}

.layer3 {
  background: rgba(255,77,69,0.6);
}

.layer4 {
  background: rgba(242,255,0,0.6);
}

.layer5 {
  background: rgba(73,169,0,0.35);
}

section {
  margin: 50px 0 85px;
}

h2 {
  _xcj_background: shape(
    outline: d(M10 0 L10 50% M3 10 L55% 10
               M65% 100%-10 L100% 100%-10 M100%-10 100% L100%-10 25%)
  );
  border: 1px solid #888;
  color: #777;
  display: inline-block;
  font-size: 32px;
  margin: 0 10px 25px;
  padding: 15px 20px;
  -webkit-transform: rotate(-2deg);
  transform: rotate(-2deg);
}

.folder-container {
  margin: 0 auto;
  overflow: hidden;
  width: 250px;
}

.folder {
  _xcj_background: shape(
    outline: d(M0 10 L5 0 L45 0 L50 8 L100% 8
               L100% 100% L0 100% z)
  );
  color: #fff;
  float: left;
  font-size: 18px;
  font-weight: bold;
  margin: 0 10px 10px 0;
  padding: 30px 0 25px;
  text-align: center;
  text-shadow: 1px 1px 3px rgba(0,0,0,.3);
  width: 120px;
}

.folder:nth-child(2n) {
  margin-right: 0;
}

.folder1 {
  background: #f75;
}

.folder2 {
  background: #00AFFB;
}

.folder3 {
  background: #F4D100;
}

.folder4 {
  background: #31C73D;
}

.hexagon {
  _xcj_background: shape(
    outline: polygon(6, 230, 50%)
  );
  background: #7D48A2;
  color: #fff;
  font-size: 27px;
  font-weight: bold;
  height: 140px;
  margin: 0 auto;
  padding: 90px 0 0;
  text-align: center;
  width: 230px;
}

.corner-shape-section {
  overflow: hidden;
  margin: 0 auto;
  width: 370px;
}

.cs-sample {
  color: #555;
  float: left;
  font-size: 30px;
  font-weight: bold;
  height: 110px;
  line-height: 1;
  padding: 70px 0 0;
  text-align: center;
  width: 180px;
}

.curve {
  _xcj_background: shape(
    outline: polygon(3, 205, 50%, 50%+10),
    outline-filter: corner-shape(curve, 10)
  );
  border: 5px solid #fc3;
}

.bevel {
  _xcj_background: shape(
    outline: polygon(5, 175, 50%, 50%-5),
    outline-filter: corner-shape(bevel, 15)
  );
  border: 5px solid #f99;
}

.notch {
  _xcj_background: shape(
    outline: polygon(4, 190, 50%),
    outline-filter: corner-shape(notch, 15)
  );
  border: 5px solid #7c5;
}

.scoop {
  _xcj_background: shape(
    outline-filter: corner-shape(scoop, 30)
  );
  border: 5px solid #5ac;
  height: 105px;
  margin: 0 10px 10px;
  width: 160px;
}

.ribbon {
  _xcj_background: shape(
    outline-filter: modify(+[3](L50% 100%-35))
  );
  border: 5px solid #f03;
  color: #f03;
  font-size: 45px;
  font-weight: bold;
  margin: 0 auto;
  padding: 40px 25px 70px;
  text-align: center;
  width: 110px;
}

.arrow {
  _xcj_background: shape(
    outline-filter: modify(+[2](L100% 50%), [1]+=(-40 0), [2]+=(-40 0) )
                    corner-shape(curve, 8)
  );
  background: #FF9500;
  color: #fff;
  font-size: 60px;
  font-weight: bold;
  line-height: 1;
  margin: 0 auto;
  padding: 15px 0 15px 20px;
  width: 230px;
}

.mix {
  _xcj_background: shape(
    outline: polygon(12, 100%, 50%),
    outline-filter: modify( [2]=(Q73% 26%, 214 57), -[8], -[10] )
  );
  background: #3ca;
  color: #555;
  font-size: 50px;
  font-weight: bold;
  line-height: 1;
  margin: 0 auto;
  padding: 85px 15px 15px ;
  text-align: center;
  width: 200px;
  height: 130px;
}

.solid-balloon {
  _xcj_background: shape(
    outline: d(M10 30 L50 50 L20% 10 L60% 0 L100%-20 40
               L100%-10 60% L100%-50 100%-20 L40% 100% L70 100%-20
               L20 70% L40 80 z)
  );
  border: 5px solid #CABE95;
  color: #555;
  font-weight: bold;
  padding: 30px 45px 25px 80px;
}

.braces {
  _xcj_background: shape(
    outline: d(M40 0 C-10 5, 45 50%-15, 0 50% C45 50%+15, -10 100%-5, 40 100%
               M100%-40 0 C100%+10 5, 100%-45 50%-15, 100% 50% C100%-45 50%+15, 100%+10 100%-5, 100%-40 100%)
  );
  border: 7px solid #aaa;
  color: #555;
  font-weight: bold;
  margin: 0 auto;
  padding: 10px 45px;
  width: 360px;
}

.fluffy {
  _xcj_background: shape(
    outline: d(M40 30 C15% -20, 50% 30, 95% 10
               C80% 25%, 110% 80%, 82% 100%-10
               C60% 100%, 50% 90%, 10% 100%-5
               Q0 50% 40 30 z),
    outline-filter: corner-shape(curve, 50)
  );
  background: #fc3;
  color: #555;
  font-weight: bold;
  margin: 0 auto;
  padding: 25px 50px;
}


/* resize UI */
.resize-control {
  background: rgba(150,150,150,.8);
  bottom: 0;
  color: #fff;
  display: none;
  font-size: 22px;
  font-weight: bold;
  padding: 15px;
  position: fixed;
  text-align: center;
  text-indent: -2em;
  vertical-align: middle;
  width: 433px;
}

[type=range] {
  vertical-align: middle;
}


/* syntax highlight */
.hljs {
  clear: both;
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  margin: 0 10px;
  background: #eee;
  border-radius: 5px;
  color: black;
  -webkit-text-size-adjust: none;
}

.hljs-attribute {
  color: #D49500;
}

.hljs-class {
  color: #740;
}

.hljs-value {
  color: #55B1FF;
}

.hljs-comment {
  color: #aaa;
}

              
            
!

JS

              
                $(function () {
  xcj.parseStyle($('style')[0]);
  $('.header-layer').animate({opacity: 1}, 1000);
  
  // 以下リサイズUI用コード
  var resizeTarget;
  $('[data-resize-min], .resize-control').hover(function () {
    if ($(this).is('[data-resize-min]')) {
      var range = $('[type=range]')[0];
      range.min = $(this).data('resize-min');
      range.max = $(this).data('resize-max');
      range.value = $(this).width();
      resizeTarget = this;
    }
    $('.resize-control').stop().fadeIn(300);
  }, function () {
    $('.resize-control').stop().fadeOut(800);
  });
  
  $('[type=range]').on('input change', function () {
    $(resizeTarget).css('width', this.value);
  });
});
              
            
!
999px

Console