cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <!-- NOTES: Ever since the realse of Chrome38, the img & srcset solution for picturefill.js has been busted for that browser.  This demo will work if being viewed in Firefox tho -->

<!-- Put the smallest img first in srcset because it is going to load that image regardless.  Or you could put a super small image. -->
<article>
<img id="bearIMG"
 srcset="https://i.imgur.com/u9PaEmr.jpg 320w,
   https://i.imgur.com/ABXCODX.png 600w,  
         https://i.imgur.com/uzvVYQL.jpg 900w"
     sizes="(min-resolution: 2dppx) 50%, 100%"
     alt="How about dem bears?"
   src="https://i.imgur.com/V4ruZ1O.jpg" >
</article>

<!-- sizes="(min-width: 500px) 50%, 100%" -->
            
          
!
            
              * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  padding-top: 20px;
}

article {
  margin: 0 auto;
  max-width: 1000px;
  text-align: center;
}

article img {
  max-width: 70%;
}

.vw-line {
  text-align: center;
  &:last-of-type{
    margin-bottom: 1em;
  }
}

body{ background-color: #14191C;}
p {
  color: #E5D2B6;
  text-shadow: 2px 2px 1px #000;
  font-size: 20px;
  font-family: sans-serif;
  padding:3px 0;
}

/*@media 
(min-resolution: 2dppx){
  p{
    background:tomato;
  }
}*/
            
          
!
            
              $("<div />", {
  class: 'vw-line',
  html: "<p>IMG Width: <span id='imgw'></span>px</p>"
}).prependTo("body");

$("<div />", {
  class: 'vw-line',
  html: "<p>Viewport Width: <span id='vw'></span>px</p>"
}).prependTo("body");

var vwDisplay = $("#vw");
var imgwDisplay = $("#imgw");
$(window).on("resize", function() {
  imgwDisplay.text($("#bearIMG").width());
  vwDisplay.text($(this).width());
}).resize();
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console