Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <base href="http://thenewcode.com/assets/images/">
<div id="proglight" class="progrock">
<figure>
	<img src="sossusvlei-namibia-thumb.jpg" srcset="sossusvlei-namibia-thumb-2x.jpg 2x" alt="Stunted dead black trees photographed against red dunes and a blue sky">
	<figcaption>
	<h1>Sossusvlei salt pan, Namib Desert</h1>
	<p>One of the harshest and most unforgiving environments on Earth, the Sossusvlei is in the southern part of the Namib Desert, in the African nation of Namibia. Surrounded by high red dunes, the Sossusvlei literally translates as "dead-end marsh", i.e., a drainage area with no outflows. These geographical conditions have created a surreal landscape, making it a popular destination for both tourists and film units: key scenes of <cite>The Cell</cite> and <cite>The Fall</cite> were shot here.
	</figcaption>
</figure>

<figure>
	<img src="breiðamerkursandur-beach-iceland-thumb.jpg" srcset="breiðamerkursandur-beach-iceland-thumb-2x.jpg 2x" alt="Clear chunks of ice backlit by a setting sun on a black sand beach">
	<figcaption>
	<h1>Breiðamerkursandur, Iceland</h1>
	<p>Breiðamerkursandur is a black sand beach on the southwest coast of Iceland, adjoining an outwash plain near the glacial lagoon of Jökulsárlón. Every spring and summer ice calving from the tongue of the glacier falls into the Atlantic and is swept out to sea before being returned to the beach, smoothed into sculptured shapes by the waves. Jökulsárlón has been the setting for four Hollywood movies, including <cite>A View to a Kill</cite>, <cite>Die Another Day</cite>, <cite>Lara Croft: Tomb Raider</cite> and <cite>Batman Begins</cite>.
	</figcaption>
</figure>
</div> 
<dialog id="fullDetails"></dialog>
<script src="//thenewcode.com/assets/scripts/extras/dialog-polyfill.js"></script>
              
            
!

CSS

              
                @font-face {
  font-family: "SSStandard";
  src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/ss-standard.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}
.semantic-icon {
  /* for close button */
  font-family: "SSStandard";
  text-decoration: none;
  text-rendering: optimizeLegibility;
  -moz-font-feature-settings: "liga=1";
  -moz-font-feature-settings: "liga";
  -ms-font-feature-settings: "liga" 1;
  -o-font-feature-settings: "liga";
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
	
@keyframes fadeToNearBlack{
	to { background: rgba(0,0,0,0.9); }
}
@keyframes fadeToClear{
	to { background: rgba(0,0,0,0); }
}
@keyframes fallDown { 
	to { top: 50%; }
}
@keyframes fallOff { 
	to { top: 200%; } 
}
body { 
  font-family: Avenir, sans-serif; 
}
#proglight { 
  display: flex; 
  justify-content: space-between; 
  flex-direction: row; 
  max-width: 1200px;
  margin: 0 auto;
}
.progrock h1 { font-weight: 100; }
.progrock img { 
  float: left; 
  width: 50%; 
}
.progrock p, .progrock h1 { 
  margin-left: calc(50% + 2rem); 
}
figure.min *:not(img) { 
  display: none; 
}
figure.min img { width: 100%; }
figure.min:hover { 
  cursor: pointer; 
}
dialog { 
  position: fixed;
  left: 50%; top: -50%;
  transform: translate(-50%, -50%);
  border: none;
  background: #fff;
}
dialog[open] {
  animation: fallDown 1s .4s forwards;
  width: 80%; margin: auto;
  max-width: 750px;
  padding: 0;
}
dialog[open] img {
  width: 100%; 
  height: auto; 
  float: none;
}
dialog[open] p, dialog[open] h1 {
  margin-left: 0;
  padding: 0 2rem; 
}
dialog.closer {
	top: 50%;
	animation: fallOff 1s .4s forwards;
}
#closeDetails { 
  position: fixed;
  right: -10px;
  top: -10px;
  border-radius: 50%;
  font-size: 1.1rem;
  color: #fff;
  background: rgba(0,0,0,0.8);
	transition: .3s background;
	outline: none;
	border: 2px solid #ccc;
	line-height: 1.3;
	padding-top: .3rem;
	box-shadow: 0 0 8px rgba(0,0,0,0.3);
}
#closeDetails:hover { 
	cursor: pointer;
	background: rgba(0,0,0,1);
}
dialog[open]::backdrop { 
  animation: fadeToNearBlack 1s forwards; 
}
dialog.closer::backdrop, dialog.closer + .backdrop { 
	background: rgba(0,0,0,0.9);
	animation: fadeToClear 1s 1s forwards; 
}

.backdrop { 
  /* needed for polyfill */
  position: fixed;
  background-color: rgba(0,0,0,0.1);
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
	animation: fadeToNearBlack 1s forwards; 
}
#notification {
  text-align: center;
}
@media screen and (max-width: 800px) {
.progrock img { 
  float: none; 
  width: 100%;
  display: block;
}
.progrock p, .progrock h1 { 
  margin-left: 0; 
}
}
@media screen and (max-width: 600px) {
	#proglight {
          flex-direction: column;
    }
}

              
            
!

JS

              
                // uses Google polyfill for dialog element in non-supporting browsers
// (https://github.com/GoogleChrome/dialog-polyfill)
// uses picturefill for lack of support of srcset on initial load
// (https://github.com/scottjehl/picturefill)

function closeDialog(){
		dialog.innerHTML = "";
  dialog.classList.remove("closer");
		dialog.close();
}

function showDialog(panelImg, panelContent) {
		var fullImage = document.createElement("img")
		fullImage.src = panelImg.src.replace("-thumb", '');
		if (panelImg.hasOwnProperty('srcset')) {
			fullImage.srcset = panelImg.srcset.replace(/-thumb/g, '');
		}
		fullImage.alt = panelImg.alt;
		var closedialog = document.createElement("button");
		closedialog.id = "closeDetails";
		closedialog.classList.add("semantic-icon");
		closedialog.innerHTML = "close";
		dialog.appendChild(closedialog);
		dialog.appendChild(fullImage);
		var textContent = panelContent.cloneNode(true);
		dialog.appendChild(textContent);
		dialog.classList.add("progrock");
		dialog.showModal();
		
		closedialog.onclick = function() {
			dialog.classList.add("closer");
		setTimeout(function() {	closeDialog() }, (2000))
	}
}
var panels = document.querySelectorAll("#proglight figure"),
minMatch = window.matchMedia("(min-width: 800px)");
if (minMatch.matches) {
	Array.prototype.forEach.call(panels, function(panel) {
    	panel.classList.add("min");
    	panel.addEventListener("click", function(){ 
	    	var panelImg = this.getElementsByTagName("img")[0];
			var panelContent = this.querySelector("figcaption");
			console.log(panelImg);
	    	showDialog(panelImg, panelContent);
	    })
	});	
var dialog = document.getElementById("fullDetails"),
testdialog=document.createElement("dialog");
	testdialog.setAttribute("open", "");
	if (!testdialog.open){
		dialogPolyfill.registerDialog(dialog);
	}
var flexContainer = document.getElementById("proglight");
  var notification = document.createElement("p");
  notification.id="notification";
  notification.innerHTML = "Click on either image for lightbox display; UI or Enter key to close";
  flexContainer.parentNode.insertBefore(notification, flexContainer.nextSibling);
}
              
            
!
999px

Console