HTML
<div > <img src="http://www.google.com/images/logo.gif" height="100" /></div>
CSS
.image-container { width: 150px; border: solid 1px red; margin:100px;}.image-container img { border: solid 1px green;}
jQuery
$(".image-container>img").each(function(i, img) { $(img).css({ position: "relative", left: ($(img).parent().width() - $(img).width()) / 2 });});
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)