css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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. 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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <h1 class="title">Full Width Image with calc()</h1>
<p class="description">Break out of a parent container using <a  href="https://developer.mozilla.org/en-US/docs/Web/CSS/calc">calc()</a>.</p>

<div class="wrap">
  
  <section class="content-section">
    
    <header>
      <h1>This image is full-width, even though the parent container has padding.</h1>
    </header>
    
    <article>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quid minus probandum quam esse aliquem beatum nec satis beatum? Maximas vero virtutes iacere omnis necesse est voluptate dominante. Mihi enim erit isdem istis fortasse iam utendum. Istam voluptatem, inquit, Epicurus ignorat? Quae in controversiam veniunt, de iis, si placet, disseramus. Duo Reges: constructio interrete. Rhetorice igitur, inquam, nos mavis quam dialectice disputare? Sed virtutem ipsam inchoavit, nihil amplius. </p>      
      <img src="https://unsplash.it/1200/600" class="full-width">
      
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quid minus probandum quam esse aliquem beatum nec satis beatum? Maximas vero virtutes iacere omnis necesse est voluptate dominante. Mihi enim erit isdem istis fortasse iam utendum. Istam voluptatem, inquit, Epicurus ignorat? Quae in controversiam veniunt, de iis, si placet, disseramus. Duo Reges: constructio interrete. Rhetorice igitur, inquam, nos mavis quam dialectice disputare? Sed virtutem ipsam inchoavit, nihil amplius. </p>
      
      <img src="https://unsplash.it/300/200" class="alignleft">
      
      <p>Aliter enim explicari, quod quaeritur, non potest. Nam ista vestra: Si gravis, brevis; Hoc ipsum elegantius poni meliusque potuit. At multis se probavit. Si est nihil nisi corpus, summa erunt illa: valitudo, vacuitas doloris, pulchritudo, cetera. Nam Pyrrho, Aristo, Erillus iam diu abiecti. </p>
      <p>Sed haec omittamus; Quorum altera prosunt, nocent altera. Et nemo nimium beatus est; </p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed quid minus probandum quam esse aliquem beatum nec satis beatum? Maximas vero virtutes iacere omnis necesse est voluptate dominante. Mihi enim erit isdem istis fortasse iam utendum. Istam voluptatem, inquit, Epicurus ignorat? Quae in controversiam veniunt, de iis, si placet, disseramus. Duo Reges: constructio interrete. Rhetorice igitur, inquam, nos mavis quam dialectice disputare? Sed virtutem ipsam inchoavit, nihil amplius. </p>

      <img src="https://unsplash.it/300/200" class="alignright">
      
      <p>Deinde dolorem quem maximum? Ita enim vivunt quidam, ut eorum vita refellatur oratio. Si mala non sunt, iacet omnis ratio Peripateticorum. Hoc dictum in una re latissime patet, ut in omnibus factis re, non teste moveamur. Tubulum fuisse, qua illum, cuius is condemnatus est rogatione, P. Sed haec quidem liberius ab eo dicuntur et saepius. Omnium enim rerum principia parva sunt, sed suis progressionibus usa augentur nec sine causa; Sic enim censent, oportunitatis esse beate vivere. Illa tamen simplicia, vestra versuta. </p>
      <p>Aliter enim explicari, quod quaeritur, non potest. Nam ista vestra: Si gravis, brevis; Hoc ipsum elegantius poni meliusque potuit. At multis se probavit. Si est nihil nisi corpus, summa erunt illa: valitudo, vacuitas doloris, pulchritudo, cetera. Nam Pyrrho, Aristo, Erillus iam diu abiecti. </p>
    </article>
    
    <footer>
    </footer>
  
  </section>
  
</div><!-- .wrap -->
            
          
!
            
              .wrap {
    margin: 0 auto;
    max-width: 960px;
    padding: 0 48px;
}

.content-section {
    background-color: #fff;
    margin-bottom: 48px;
    padding: 48px;
    position: relative;
  
  h1 {
      margin-bottom: 48px;
      text-align: center;
  }
}

.full-width {
    position: relative;
    left: -48px;
    width: calc(100% + 96px); // Each gutter is 48px. 48 * 2 = 96
}

// Design stuff for this pen (ignore me)
body { background: #333; color: #333; font-family: sans-serif;	text-align: left; } .title { text-align: center; margin-bottom: 0; color: #fff; text-shadow: 1px 1px 0 #000; } .description { text-align: center; margin-bottom: rem(48); color: #fff; text-shadow: 1px 1px 0 #000; } .alignleft { text-align: left; float: left; margin: 24px 24px 24px 0; } .alignright { text-align: right; float: right; margin: 24px 0 24px 24px; }
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console