I have searched the web for solutions, but all of them were talking about how to set the background for the whole page...but i need to fill out a certain section of the page....how can i do that?
Here's what we have.....on our page, we have several different sections and in one of them i need to set the image's background-size to "cover" (this is the only time i am using this property). This is the php function I'm using to generate img tag:
function getRandomFeatureVideo()
{
// Youtube feed
$xml = simplexml_load_file('https://gdata.youtube.com/feeds/api/playlists/A4F160EDF82713A2?v=2');
.
.
.
.
$media = $entry->children('http://search.yahoo.com/mrss/');
// get video player URL
$attrs = $media->group->player->attributes();
$watch = $attrs['url'];
$attrs = $media->group->thumbnail[1]->attributes();
$thumbnail = $attrs['url'];
$counter++;
if($counter == $rand)
{ break; }
$result .='<a rel="prettyVideos" href="'.$watch.'">
<img alt="" style="background:url('.$thumbnail.')" src="/images/ytIndex_overlay.png" />
</a> ';
echo $result;
}
and CSS:
.slideshow .video img
{
cursor:pointer;
width:550px !important;
height:340px !important;
background-repeat:no-repeat;
background-size:cover;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
-ms-interpolation-mode: bicubic;
}
So far it's working exactly how I was hoping for in Chrome, Safari, Firefox and Opera.
However, as usually, it's messed up in IE (7/8)
How can i fix this?