Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <section role="main">
	<header>
		<h1>Semantic Remapping - Framework Centipede example</h1>
	</header>
	<p>Here we have a fun example where we're using two CSS frameworks (Yahoo Pure and Twitter Bootstrap) and two modal libraries (Bootstrap's modal.js and Colorbox.js).</p>
	<p>NOTE: we're only using the modal and transition files from the javascript portion of Bootstrap's JS framework to minimize bloat.</p>
	<p>And speaking of bloat, how much space does all the CSS we're using from Bootstrap, Pure, and Colorbox take up?  --just <em>2.57kb</em> when compressed and minified</p>
	<p>Remember that Bootstrap's CSS  is 19.72kb compressed and minified all by itself!  It's not blood magic, just a cool trick you can do with your CSS Preprocessor.  Read more about it <a href="https://medium.com/@dehuszar/semantic-remapping-with-css-pre-processors-906ba1a9910c" target="_blank">here</a></p>
	<button class="modal-trigger" data-toggle="modal" data-target=".bootstrap-message-wrapper">Pure Button - Bootstrap Modal</button>
	<a href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/18728/angry-panda-office.gif"  class="modal-trigger" title="Panda doesn't like it when you abuse utility classes">Bootstrap Button - Colorbox Modal</a>
</section>
<div class="bootstrap-message-wrapper modal fade" role="dialog">
	<div class="modal-dialog dialog-wrapper">
		<div class="modal-content content-wrapper" role="document">
			<header>
				<button data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h2>Bootstrap Modal!</h2>
			</header>
			<article>
				<p>Unfortunately, Bootstrap's modal logic is set up in such a way that we have to keep a few of these silly modal-classes around for things to work; even if we're not even binding the Bootstrap modal styling to those classes any more.</p>
				<p>That said, I've had several projects where I needed to use a Bootstrap modal mixed with other UI libraries/frameworks.  This makes fairly quick work of that task, am I right?</p>
			</article>
		</div>
	</div>
</div>
              
            
!

CSS

              
                @import (reference) 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/18728/pure.less';
@import (reference) 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/18728/grids-responsive.less';
@import (reference) 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/18728/bootstrap.less';
@import 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/18728/colorbox.css';

[role="main"]:extend(.pure-g) {
	margin: 2em;
	
	header, p {
		&:extend(.pure-u-1-1);
	}
}

[role="main"] button.modal-trigger:extend(.pure-u-1-2, .pure-button all, .pure-button-primary all) {}

[role="main"] a.modal-trigger:extend(.pure-u-1-2, .btn all, .btn-primary all) {
	box-sizing: border-box;
}

// Bootstrap modal rules
.modal-open:extend(.modal-open) {}
.modal-backdrop:extend(.modal-backdrop,
						.modal-backdrop.fade,
						.modal-backdrop.in all) {}

.bootstrap-message-wrapper:extend(.modal all, .fade all) {
	&.in:extend(.fade.in all) {
		.dialog-wrapper:extend(.modal.in .modal-dialog all, .modal.fade .modal-dialog all) {}
	}
	
	.dialog-wrapper:extend(.modal-dialog all) {}
	.content-wrapper:extend(.modal-content all) {}
	header:extend(.modal-header) {}
	header h2:extend(.modal-title) {}
	header button:extend(.modal-header .close, .button.close, .close) {
		background-color: transparent;
    	border: 0;
	}
	article:extend(.modal-body) {}
}

#cboxContent img {
	height: auto!important;
	margin-top: 0!important;
	width: 100%!important;
}
              
            
!

JS

              
                $('[role="main"] button + a').colorbox({innerWidth: "485px", innerHeight: "336px"});
              
            
!
999px

Console