I am currently working on a site in which I need hearts. I create the hearts using JavaScript and CSS:
function heart(x, y, pos, width, r) {
var height = width + (width / 2 + 1);
var heart = "position:" + pos + ";left:" + x + "px;top:" + y + "px;width:" + width + "px;height:" + height + "px;transform: rotate(" + r + "deg);-moz-transform: rotate(" + r + "deg);-webkit-transform: rotate(" + r + "deg);";
var slices = "left:" + width + "px;width:" + width + "px;height:" + height + "px";
$("body").append('<div class="heart" style="' + heart + '"><div class="slice" style="' + slices + '"></div><div class="slice2" style="' + slices + '"></div></div>');
}
I'm currently trying to put a large heart under a box using:
heart(282, 69, "absolute", 230, 0);
However, z-index
is not doing anything, as you can see in my JSFiddle example.
I've even tried setting the z-index
of the universal selector (*) to 0 while changing the z-index
of the box to 10 !important;
but that didn't work either. I am puzzled about why this is happening, but I'm pretty sure it has to do with the dynamic heart. Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…