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

+ add another resource


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


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.


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.


                <div class="parent" id="parent">

  <div class="child">
  <p>The blue box and the text are child elements of the element that has a photo background. The child elements do not inherit the opacity setting on the parent. This is done using a jedi mind trick, aka "JavaScript".</p>
  <p>The rest of this is just filler text. Don't read this, you're just wasting your time. Are you serious? You're still reading? I'm not lying, this is just filler. I just need this to wrap below the box. That's all.</p>


                * {
  box-sizing: border-box;  

body {
  padding-top: 30px;

.parent {
  width: 500px;
  background-image: url(;
  border: solid 3px black;
  margin: 0 auto;
  padding: 30px;
  opacity: .2;
	filter: alpha(opacity=20);
  .child {
    width: 150px;
    height: 150px;
    background: blue;
    float: left;
    margin: 0 20px 10px 0;
    border: solid 5px yellow;
    box-shadow: rgba(0, 0, 0, .2) 4px 4px 5px;

p { margin: 0 0 20px 0; }


ThatsNotYoChild.js, by Louis Lazaris
This is a hacky workaround to let you use opacity on any element and prevent the child elements from inheriting the opacity.
Works in IE8+.
If anyone can get line 23 working in IE7, it will be fully cross-browser.
function thatsNotYoChild(parentID) {

  var parent           = document.getElementById(parentID),
      children         = parent.innerHTML,
      wrappedChildren  = '<div id="children" class="children">' + children + '</div>',
      x, y, w, newParent, clonedChild, clonedChildOld;

  parent.innerHTML = wrappedChildren;
  clonedChild = document.getElementById('children').cloneNode(true);
  document.getElementById('children').id = 'children-old';
  clonedChildOld = document.getElementById('children-old');
  newParent = parent.parentNode;

  newParent.appendChild(clonedChild); = '0'; = 'alpha(opacity=0)';

  function doCoords () {
    x = clonedChildOld.getBoundingClientRect().left;
    y = clonedChildOld.getBoundingClientRect().top;
    if (clonedChildOld.getBoundingClientRect().width) {
      w = clonedChildOld.getBoundingClientRect().width; // for modern browsers
    } else {
      w = clonedChildOld.offsetWidth; // for oldIE
    } = 'absolute'; = x + 'px'; = y + 'px'; = w + 'px';

  window.onresize = function () {





// call the function and pass the ID of the parent that has opacity set.