Create shadow by CSS only (css3)
stage 1 is making simple html, with a container element, all the content inside, and in it a child element with all the hover content:
<a class="cbs-pictureImgLink" href="…">
<img src="…" class="cbs-pictureOnTopImg" >
<!-- and all other content -->
<div class="inspectItem">
<img src="../mouseovericon.png">
<!-- and all other hover content -->
</div>
</a>
now all that's left is some simple css:
.inspectItem {
opacity: 0;
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.12);
-webkit-transition: opacity ease 0.3s;
-moz-transition: opacity ease 0.3s;
-o-transition: opacity ease 0.3s;
transition: opacity ease 0.3s;
}
.inspectItem:hover { opacity: 1; }
some simple notes:
background: rgba(0, 0, 0, 0.12); means that while hovering whats the shadow gonna be.
<xxx>transition: opacity ease 0.3s; means how fast is will appear.
<a class="cbs-pictureImgLink" href="…">
<img src="…" class="cbs-pictureOnTopImg" >
<!-- and all other content -->
<div class="inspectItem">
<img src="../mouseovericon.png">
<!-- and all other hover content -->
</div>
</a>
now all that's left is some simple css:
.inspectItem {
opacity: 0;
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.12);
-webkit-transition: opacity ease 0.3s;
-moz-transition: opacity ease 0.3s;
-o-transition: opacity ease 0.3s;
transition: opacity ease 0.3s;
}
some simple notes:
background: rgba(0, 0, 0, 0.12);
<xxx>transition: opacity ease 0.3s;
Comments
Post a Comment