I am using the HTML IMG tag to source/link an image and I want to center it in a div, but I am not having much success.
My html is:
<div class="alimgholder">
<img title="<?php echo $album_title;?>" alt="<?php echo $album_title;?>" src="<?php echo $album_pic;?>">
</div>
My css is:
.alimgholder
{
width:160px;
height:120px;
overflow:hidden;
float:left;
}
.alimgholder img
{
background-color: #EEEEEE;
background-position: center 25%;
background-repeat: no-repeat;
display: block;
}
set the css for the div only –
Now for the dynamic issue – you can use the img tag to load the image, but hide it and read its src only to set the background with jQuery, like that –