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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <html>
<body>
  <br />
  <a href="#carbs" class="fancybox">Carbs</a> /
  <a href="#protein" class="fancybox">Protein</a> /
  <a href="#dairy" class="fancybox">Dairy</a> /
  <a href="#fruit-veg" class="fancybox">Fruit/veg</a> /
  <a href="#sugar" class="fancybox">Sugar</a>
  <br /><br />
  <figure class="align-center">
    <svg class="image-map" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 760 580" xml:space="preserve" class="eatwell-plate">
							<image xlink:href="../../img/content/diagrams/eatwell-plate.png" x="0" y="0" height="580px" width="760px" />
							<path href="#protein" d="M251.9,456.4C287.4,483.7,331.8,500,380,500c11.8,0,23.3-1,34.6-2.8L380,290L251.9,456.4z" />
							<path href="#fruit-veg" d="M380,80c-116,0-210,94-210,210c0,67.8,32.1,128,81.9,166.4L380,290V80z" />
							<path href="#carbs" d="M527.3,439.6C566,401.6,590,348.6,590,290c0-116-94-210-210-210v210L527.3,439.6z" />
							<path href="#sugar" d="M380,290l129.3,165.5c6.3-4.9,12.3-10.2,18-15.8L380,290z" />
							<path href="#dairy" d="M414.6,497.2c35.3-5.9,67.7-20.5,94.8-41.7L380,290L414.6,497.2z" />
						</svg>
  </figure>

  <!-- FANCYBOX (hidden) CONTENT -->
  <div id="carbs" class="hide">
    <h3>Carbohydrates</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
  </div>
  <div id="protein" class="hide">
    <h3>Protein</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
  </div>
  <div id="dairy" class="hide">
    <h3>Dairy products</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
  </div>
  <div id="fruit-veg" class="hide">
    <h3>Fruits and vegetables </h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
  </div>
  <div id="sugar" class="hide">
    <h3>Sugary treats</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
  </div>
  <!-- END FANCYBOX (hidden) CONTENT -->
</body>
</html>
              
            
!

CSS

              
                /*------------------------------------*\
    #HELPERS
\*------------------------------------*/

.hide {
  display: none;
}

/*------------------------------------*\
    #BASE
\*------------------------------------*/

html {
	background: #fff;
	font-size: 62.5%;
	height: 100%;
	min-height: 100%;
}

body {
	background-color: #fff;
	color: #666;
  font-size: 16px;
	font-weight: 400;
	height: 100%;
	min-height: 100%;
	margin: 0 auto;
	padding: 0;
	width: 100%;
  max-width: 800px;
}


/*------------------------------------*\
    #FANCYBOX
\*------------------------------------*/

.fancybox-wrap,
.fancybox-skin,
.fancybox-outer,
.fancybox-inner,
.fancybox-image,
.fancybox-wrap iframe,
.fancybox-wrap object,
.fancybox-nav,
.fancybox-nav span,
.fancybox-tmp {
	border: 0;
	margin: 0;
	outline: none;
	padding: 0;
	vertical-align: top;
}

.fancybox-wrap {
	background: #fff;
	border-radius: 8px;
	margin-bottom: 20px;
	left: 0;
	position: absolute;
	top: 0;
	z-index: 9000;
}

.fancybox-skin {
	position: relative;
}

.fancybox-opened {
	z-index: 8030;
}

.fancybox-outer, 
.fancybox-inner {
	position: relative;
}

.fancybox-inner {
	overflow: hidden;
}

.fancybox-type-iframe .fancybox-inner {
	-webkit-overflow-scrolling: touch;
}

.fancybox-overlay {
	background: rgba(0,0,0,.80);
	display: none;
	left: 0;
	overflow: hidden;
	position: absolute;
	top: 0;
	z-index: 8010;
}

.fancybox-overlay-fixed {
	bottom: 0;
	position: fixed;
	right: 0;
}

.fancybox-lock .fancybox-overlay {
	overflow: auto;
	overflow-y: scroll;
}
              
            
!

JS

              
                // BASE FANCYBOX

$(document).ready(function() {
  $(".fancybox").fancybox({
    margin: [20, 40, 20, 40],
    padding: [20, 20, 0, 20],
    openEffect: "fade",
    openEasing: "easeInQuad",
    openSpeed: 400,
    title: false,
    scrolling: "no", // turns off scrolling in box.
    fitToView: false, // allows box to overflow out of viewport.
    autoSize: false, // needs to be turned on for width/maxWidth to work.
    height: "auto", // if autoSize is set to 'false', this needs to be 'auto' so height matches content.
    width: "100%",
    minHeight: 0,
    maxWidth: 900,
    helpers: {
      overlay: {
        showEarly: false
      }
    }
  });
});

// IMAGE MAP/PATH FANCYBOX

$(document).ready(function() {
  $(".image-map path").on("click", function() {
    $.fancybox.open({
      href: $(this).attr("href"),
      margin: [20, 40, 20, 40],
      padding: [20, 20, 0, 20],
      openEffect: "fade",
      //openEasing: 'easeInQuad',
      openSpeed: 400,
      title: false,
      scrolling: "no", // turns off scrolling in box.
      fitToView: false, // allows box to overflow out of viewport.
      autoSize: false, // needs to be turned on for width/maxWidth to work.
      height: "auto", // if autoSize is set to 'false', this needs to be 'auto' so height matches content.
      width: "100%",
      minHeight: 0,
      maxWidth: 900,
      helpers: {
        overlay: {
          showEarly: false
        }
      }
    });
  });
});

              
            
!
999px

Console