I have CSS style within HTML. A responsive image grid is produced from SQL images. I am trying to create a bookmark overlay to add as favourite.
I've tried a number of tutorials. Also, have copied the image DIV and changed the Z position to place above the image, but cannot see the overlay image at all.
style sheet:
#gridview {
text-align:center;
}
div.image {
margin: 10px;
display: inline-block;
position: relative;
z-index: 1;
}
div.image img {
width: 100%;
height: auto;
position: relative;
border: 1px solid #ccc;
z-index: 1;
}
div.image img:hover {
box-shadow: 0 5px 5px 0 rgba(0,0,0,0.32), 0 0 0 0px rgba(0,0,0,0.16);
z-index: 1;
position: relative;
}
div.bookmark {
margin: 10px;
display: inline-block;
position: absolute;
z-index: 3;
}
div.bookmark img {
width: 100%;
background-image: url("https://images.justwatch.com/static/compile_jw/assets/ribbon-filled.png");
height: auto;
position: absolute;
z-index: 3;
}
div.bookmark img:hover {
box-shadow: 0 5px 5px 0 rgba(0,0,0,0.32), 0 0 0 0px rgba(0,0,0,0.16);
z-index: 3;
position: absolute;
}
#grid {
margin-bottom:30px;
}
@media screen and (min-width: 1224px) {
div.image {
width: 154px;
}
}
media screen and (min-width: 1044px) and (max-width: 1224px) {
div.image {
width: 154px;
}
}
@media screen and (min-width: 845px) and (max-width: 1044px) {
div.image {
width: 154px;
}
}
PHP / HTML page:
var tbl_body = "";
for (var i = 0; i < data.length; i++)
{
var tbl_row = "";
var t = i;
tbl_row += ("<div class='image'><a href='link/" + data[i]+ "'><IMG SRC='link/"+ data[i].poster +"'></a><div class='bookmark'></div> ");
tbl_row += ("</div>");
tbl_body += tbl_row
}
return tbl_body;
The outcome should be the poster image, with overlay of the bookmark image in the top corner of each poster.