jQuery - CSS Automatic margin-top
Finds every instance of the specific class, and sets the margin-top to be a negative value of the height.
<br>
Useful for image gallery captions
$(".YOURCLASS").each(function(){
$(this).css("margin-top","-"+$(this).height()+"px");
});
Written by Tom Pointon
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#