Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <html>
	<head>
		<title>Image Gallery</title>

		<!-- import bootstrap -->
<script src="https://getbootstrap.com/dist/css/bootstrap.min.css"></script>

		

		<!-- import jQuery -->
		<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
	</head>

	<body>
		
	<div class="container">
		<h1>Image Gallery</h1>

		<!--
		   These are the thumbnail images.
		   They are laid out using the 
		   bootstrap grid.
		   I have given them all the class
		   "crop-image" which I use in the
		   css and the javascript code.
		-->
		<div class="row">
			<div class="col-md-3">
				<img class="crop-img" 
				  src="https://s-media-cache-ak0.pinimg.com/originals/f7/91/29/f7912923b1a2f4749e7c19275871bb6d.jpg" 
				  alt="redhead"/> 
			</div>
			<div class="col-md-3">
				<img class="crop-img" 
				  src="https://1.bp.blogspot.com/-_agbejBrpTQ/UzgR0qaerhI/AAAAAAABXhQ/CSelnCteniw/s1600/Episode+2.06+-+Unforgiven+(4).jpg" 
				  alt="viking"/> 
			</div>
			<div class="col-md-3">
				<img class="crop-img" 
				 src="http://orig07.deviantart.net/a5a1/f/2008/305/3/6/black_metal_girl_by_systemic.jpg" 
				  alt="metalhead"/> 
			</div>
			<div class="col-md-3">
				<img class="crop-img" 
				   src="https://s-media-cache-ak0.pinimg.com/originals/34/c2/90/34c29070a189c02d8325f03ddc4c376f.jpg" 
				   alt="fitness"/> 
			</div>
		</div>
		<!--
			this is the large image which is
			on a row of its own. 
			I will change it source in the 
			javascript
		-->
		<div class="row">
			<div class="col-md-12">
				<img id="bigImage" 
				  class="large-img" 
				  src="https://s-media-cache-ak0.pinimg.com/originals/f7/91/29/f7912923b1a2f4749e7c19275871bb6d.jpg" 
				  alt="redhead"/> 
			</div>
		</div>
	</div>



	</body>
</html>

              
            
!

CSS

              
                /* this is for the thumbnail images */
.crop-img{
  max-height:150px;
  max-width:100%;
}

/* this is for the big main image */
.large-img{
  max-width:100%;
  vertical-align: middle;
}

img{
  align: inline;
}

              
            
!

JS

              
                // when we click on the thumbnail
		// we set the src attribute of the 
		// bit image to be the same as the 
		// src of the image we have clicked on
		// ("this"). This loads the same
		// image file into the big image
		$(".crop-img").click(function(){
			$("#bigImage").attr('src', 
				$(this).attr('src'));
		});
              
            
!
999px

Console