cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

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

Console