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.

            
              <ul id="thumbnails" class="thumbnails">
  <li><a href="#img1"><img src="http://www.pmob.co.uk/temp/images/zimg1.jpg" width="50" height="50"></a></li>
  <li><a href="#img2"><img src="http://www.pmob.co.uk/temp/images/zimg2.jpg" width="50" height="50"></a></li>
  <li><a href="#img3"><img src="http://www.pmob.co.uk/temp/images/zimg3.jpg" width="50" height="50"></a></li>
  <li><a href="#img4"><img src="http://www.pmob.co.uk/temp/images/zimg4.jpg" width="50" height="50"></a></li>
  <li><a href="#img5"><img src="http://www.pmob.co.uk/temp/images/zimg5.jpg" width="50" height="50"></a></li>
</ul>
<ul class="full-size">
  <li class="full" id="img1"><a href="#thumbnails"><img src="http://www.pmob.co.uk/temp/images/zimg1.jpg" width="500" height="500"></a></li>
  <li class="full" id="img2"><a href="#thumbnails"><img src="http://www.pmob.co.uk/temp/images/zimg2.jpg" width="500" height="500"></a></li>
  <li class="full" id="img3"><a href="#thumbnails"><img src="http://www.pmob.co.uk/temp/images/zimg3.jpg" width="500" height="500"></a></li>
  <li class="full" id="img4"><a href="#thumbnails"><img src="http://www.pmob.co.uk/temp/images/zimg4.jpg" width="500" height="500"></a></li>
  <li class="full" id="img5"><a href="#thumbnails"><img src="http://www.pmob.co.uk/temp/images/zimg5.jpg" width="500" height="500"></a></li>
</ul>
<div class="wrap">
<h1>Testing :target to show larger image</h1>
<p>Ideally you would not want all your large images in the page to start with so some sort of lazy load or on demand process would be required. Also the thumbnails should be a small filesize image and not just a large image width a small width and height applied.</p>
<p>However the demo is just to show how an image can be shown using :target</p>
  <p>Equation billions upon billions! Courage of our questions decipherment, take root and flourish, cosmic ocean paroxysm of global death. Light years inconspicuous motes of rock and gas from which we spring something incredible is waiting to be known, muse about!</p>
  <p>Equation billions upon billions! Courage of our questions decipherment, take root and flourish, cosmic ocean paroxysm of global death. Light years inconspicuous motes of rock and gas from which we spring something incredible is waiting to be known, muse about!</p>
  <p>Equation billions upon billions! Courage of our questions decipherment, take root and flourish, cosmic ocean paroxysm of global death. Light years inconspicuous motes of rock and gas from which we spring something incredible is waiting to be known, muse about!</p>
  <p>Equation billions upon billions! Courage of our questions decipherment, take root and flourish, cosmic ocean paroxysm of global death. Light years inconspicuous motes of rock and gas from which we spring something incredible is waiting to be known, muse about!</p>
  <p>Equation billions upon billions! Courage of our questions decipherment, take root and flourish, cosmic ocean paroxysm of global death. Light years inconspicuous motes of rock and gas from which we spring something incredible is waiting to be known, muse about!</p>
  <p>Equation billions upon billions! Courage of our questions decipherment, take root and flourish, cosmic ocean paroxysm of global death. Light years inconspicuous motes of rock and gas from which we spring something incredible is waiting to be known, muse about!</p>
  <p>Equation billions upon billions! Courage of our questions decipherment, take root and flourish, cosmic ocean paroxysm of global death. Light years inconspicuous motes of rock and gas from which we spring something incredible is waiting to be known, muse about!</p>
</div>
            
          
!
            
              html,
body {
  margin: 0;
  padding: 0;
}
body {
  background: #ccc;
}
.wrap {
  max-width: 980px;
  margin: 20px auto;
  background: #f9f9f9;
  padding: 10px;
  font-size: 1.3rem;
  border: 5px solid #000;
  box-shadow: 0 0 20px 20px rgba(0, 0, 0, 0.3);
}
.thumbnails,
.full-size {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
}
.thumbnails li {
  display: inline-block;
  margin: 10px;
  vertical-align: top;
}
.thumbnails a {
  display: block;
  width: 50px;
  height: 50px;
  border: 3px solid red;
  color: #000;
  text-decoration: none;
}
.full {
  position: fixed;
  top: 50%;
  left: 50%;
  right: 50%;
  bottom: 50%;
  z-index: -1;
  overflow: hidden;
  width: 0;
  height: 0;
  opacity: 0;
  background: rgba(0, 0, 0, 0.8);
  transition: all 2s ease;
}
.full:target {
  z-index: 100;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  opacity: 1;
  transition: opacity 2s ease;
}
.full:target img {
  width: auto;
  height: auto;
  min-width: 100%;
  min-height: 100%;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  object-fit: cover;
}
@supports (object-fit: cover) {
  .full:target img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
.full a {
  position: absolute;
  top: 40%;
  left: 40%;
  right: 40%;
  bottom: 40%;
  border: 5px solid red;
  overflow: hidden;
  z-index: -1;
  opacity: 0;
  transition: all 2s ease;
}
.full:target a {
  top: 10%;
  left: 10%;
  right: 10%;
  bottom: 10%;
  opacity: 1;
}
.full a:after {
  content: "X";
  font-family: monospace;
  font-size: 30px;
  position: absolute;
  right: 10px;
  top: 10px;
  color: #fff;
  font-weight: bold;
  border: 2px solid #fff;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  line-height: 30px;
  text-align: center;
}

            
          
!
999px
Loading ..................

Console