tags:

views:

339

answers:

1
+5  A: 

Since I've written this code for you, seems logical that I also try to fix it...

It seems that Chrome is struggling since it doesn't know the height of the element. Let's use margins instead of positioning

Also, since you are using a set height, you could drop positioning all together and use the following CSS (In which case you shouldn't need the above code):

div.imageSub img { z-index: 1; margin: 0; display: block; }
div.imageSub div {
    position: relative;
    margin: -15px 0 0;
    padding: 5px;
    height: 5px;
    line-height: 4px;
    text-align: center;
    overflow: hidden;
}
div.imageSub div.blackbg {
    z-index: 2;
    background-color: #000;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
    filter: alpha(opacity=70);
    opacity: 0.5;
}
div.imageSub div.label {
    z-index: 3;
    color: white;
}

EDIT: You've asked for a top colored bar for the gender. You can use the following HTML:

<div class="imageSub" style="width: 90px;"> <!-- Put Your Image Width -->
    <img class="female" src="http://cache2.mycrib.net/images/image_group66/0/43/t_6871399b0962b5fb4e29ce477541e165950078.jpg" alt="Something" width="90"/>
    <div class="blackbg"></div>
    <div class="label">Sara</div>
</div>

With the following CSS:

div.imageSub img.female { border-top: 10px solid red; }
div.imageSub img.male { border-top: 10px solid blue; }
Andrew Moore
Now that's full service.
seth
yes you are the best! +1
jasondavis
Actually I might have to live with it as my images are different heights, it is hard to set a height for them. Can you help me to add the top colored bar for gender please?
jasondavis
**@jasondavis:** I edited my post for the gender bar. As for the height, use my new CSS... I've removed my other solution.
Andrew Moore
Don't forget to set the answer as accepted (the little checkmark).
Andrew Moore
My new solution (remove the use of positioning) will not trigger the problem in Chrome. And you won't have to specify the height.
Andrew Moore
thank you so much you are very good!
jasondavis