cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-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.

            
              <link href="https://fonts.googleapis.com/css?family=Indie+Flower|Overpass+Mono" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<h1>Image caption hover effect using HTML and CSS</h1>
<div id="wrapper">
  <div class="image-container">
    <img src="http://imgh.us/pancake-1984716_960_720.jpg" />
    <div class="image-caption">
      <h1>coding is love</h1>
      <p>para description about this picture.</p>
    </div>
  </div>

  <div class="image-container">
    <img src="http://imgh.us/dog-1718242_960_720.jpg" />
    <div class="image-caption">
      <h1>coding is love</h1>
      <p>para description about this picture.</p>
    </div>
  </div>

  <div class="image-container">
    <img src="http://imgh.us/heart-1776746_960_720.jpg" />
    <div class="image-caption">
      <h1>coding is love</h1>
      <p>para description about this picture.</p>
    </div>
  </div>

  <div class="image-container">
    <img src="http://imgh.us/ace-1807511_960_720.jpg" />
    <div class="image-caption">
      <h1>coding is love</h1>
      <p>para description about this picture.</p>
    </div>
  </div>

  <div class="image-container">
    <img src="http://imgh.us/breakfast-1804457_960_720.jpg" />
    <div class="image-caption">
      <h1>coding is love</h1>
      <p>para description about this picture.</p>
    </div>
  </div>

  <div class="image-container">
    <img src="http://imgh.us/wintry-1959267_960_720.jpg" />
    <div class="image-caption">
      <h1>coding is love</h1>
      <p>para description about this picture.</p>
    </div>
  </div>
</div>
            
          
!
            
              #wrapper {
  padding: 0px;
  width: 820px;
  height: auto;
  margin: auto;
  overflow: hidden;
}

h1,
p {
  margin: 0px;
  padding: 0px;
}

h1 {
  text-align: center;
  font-family: 'Indie Flower', cursive;
  color: #00bfb6;
  text-decoration: underline;
}

.image-container {
  float: left;
  width: 250px;
  height: 200px;
  position: relative;
  margin: 10px;
  cursor: pointer;
}

.image-container img {
  width: 250px;
  height: 200px;
  position: absolute;
}

.image-caption {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  position: absolute;
  opacity: 0;
  transition: all 300ms ease-in-out;
  -webkit-transition: all 300ms ease-in-out;
  -moz-transition: all 300ms ease-in-out;
  -o-transition: all 300ms ease-in-out;
  -ms-transition: all 300ms ease-in-out;
}

.image-caption h1 {
  padding: 45px 0px 5px 0px;
  text-align: center;
  margin-left: -15px;
  text-transform: uppercase;
  font-family: 'Indie Flower', cursive;
  font-size: 25px;
  color: #00bfb6;
}

.image-caption p {
  text-align: center;
  font-family: 'Overpass Mono', monospace;
  color: #fff;
}

.image-container:hover .image-caption {
  opacity: 1;
}


/* media queries */

@media all and (min-width: 0px) and (max-width: 520px) {
  #wrapper {
    width: 100%;
    height: 100%;
    padding: 0px 70px
  }
}

@media all and (min-width: 521px) and (max-width: 700px) {
  #wrapper {
    width: 100%;
    height: 100%;
  }
  .image-container {
    float: left;
    width: 48%;
    margin: 5px;
    overflow: hidden;
    position: relative;
  }
  .image-caption {
    width: 250px;
    height: 200px;
  }
}
            
          
!
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