css - Place text within padding space -


i creating images polaroid effect using padding around image , setting background colour white

 img.team { background: none repeat scroll 0 0 white; box-shadow: 0 9px 25px -5px #000000; display: block; margin-left: auto; margin-right: auto; max-width: 100%; padding: 12px 12px 50px; 

}

what write caption within space under image , between padding, kind of if had wrote on felt pen. im using bootstraps thumbnails images.

i have tried negative margin on h5

 h5 { color: #333333; font-size: 1.1em; margin-top: -35px; text-align: center; 

}

html is

 <div class="container"> <div class="row"> <div class="span4"> <div class="thumbnail"> <img class="team" src="http://placehold.it/160x120" title="swimming" alt="swimming" ></a> <h5>swimming</h5> </div><!--end of thumbnail--> </div><!--end of span4--> 

however when place row of polaroids underneath overlap top ones because of margin.

has done before? appreciated

instead of styling <img>, style div.thumbnail instead:

<div class="thumbnail"> <img class="team" src="http://placehold.it/160x120" title="swimming" alt="swimming" ></a> <h5>swimming</h5> </div> 

css:

div.thumbnail { background: none repeat scroll 0 0 white; box-shadow: 0 9px 25px -5px #000000; padding: 12px; display: inline-block; } 

here demo you. note should remove negative margin <h5> too.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -