-1

I'm trying to place text over each individual img in a li, making a 3 x 3 grid. I'm using the ul to keep the images nice and responsive but cant seem to place text above them individually.

This is what I am hoping to acheive

http://tinypic.com/view.php?pic=e7fqld&s=8#.U4h3LPldUrU

And here is what I have :

http://jsfiddle.net/rfvM2/

<div id="gallery">
        <ul>            
            <li>
                <div class="gallery-image">                
                <a href=""><img src="http://lorempixel.com/output/nature-q-c-340-220-7.jpg"/>
                <p>A Movie in the Park:<br />Kung Fu Panda</p></a>
                </div>         
            </li>
            <li>
                <div class="gallery-image">                
                <a href=""><img src="http://lorempixel.com/output/nature-q-c-340-220-7.jpg"/>
                <p>A Movie in the Park:<br />Kung Fu Panda</p></a>
                </div>         
            </li>
            <li>
                <div class="gallery-image">                
                <a href=""><img src="http://lorempixel.com/output/nature-q-c-340-220-7.jpg"/>
                <p>A Movie in the Park:<br />Kung Fu Panda</p></a>
                </div>         
            </li>
            <li>
                <div class="gallery-image">                
                <a href=""><img src="http://lorempixel.com/output/nature-q-c-340-220-7.jpg"/>
                <p>A Movie in the Park:<br />Kung Fu Panda</p></a>
                </div>         
            </li>
            <li>
                <div class="gallery-image">                
                <a href=""><img src="http://lorempixel.com/output/nature-q-c-340-220-7.jpg"/>
                <p>A Movie in the Park:<br />Kung Fu Panda</p></a>
                </div>         
            </li>
            <li>
                <div class="gallery-image">                
                <a href=""><img src="http://lorempixel.com/output/nature-q-c-340-220-7.jpg"/>
                <p>A Movie in the Park:<br />Kung Fu Panda</p></a>
                </div>         
            </li>
            <li>
                <div class="gallery-image">                
                <a href=""><img src="http://lorempixel.com/output/nature-q-c-340-220-7.jpg"/>
                <p>A Movie in the Park:<br />Kung Fu Panda</p></a>
                </div>         
            </li>
            <li>
                <div class="gallery-image">                
                <a href=""><img src="http://lorempixel.com/output/nature-q-c-340-220-7.jpg"/>
                <p>A Movie in the Park:<br />Kung Fu Panda</p></a>
                </div>         
            </li>
            <li>
                <div class="gallery-image">                
                <a href=""><img src="http://lorempixel.com/output/nature-q-c-340-220-7.jpg"/>
                <p>A Movie in the Park:<br />Kung Fu Panda</p></a>
                </div>         
            </li>            
         </ul>
        </div>
web-tiki
  • 99,765
  • 32
  • 217
  • 249

1 Answers1

0

You can do this :

DEMO

CSS :

#gallery {
    width:100%;
    margin-right:auto;
    margin-left:auto;
    margin-top:45px;
    position:relative;
}
#gallery li {
    list-style-type:none;
    position:relative;
    float:left;
    width:30%;
    margin:1.66%;
}
#gallery ul p {
    position:absolute;
    top:0;
}
#gallery ul img {
    position: relative;
    width: 100%;
    background-position:center center;
    background-repeat:no-repeat;
}
web-tiki
  • 99,765
  • 32
  • 217
  • 249