JSFiddle - React, Tailwind, and code Playground
by Tinh Nguyen Nhu
HTML
<!-- gradient background hover -->
<div class="block">
<div class="content-thumb">
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" alt="thum_img">
</div>
<div class="content">
<p>12.990.000 VNĐ</p>
<p>Lenovo Thinkpad E440 20C5S06M00 - Core i5 4210M/ 4Gb/ 500Gb/ ...</p>
</div>
<div class="content-hover">
<a class="link" href="https://www.google.com/">
<span>- CPU: Core i5 4210M </span>
<br />
<span>- RAM/ HDD: 4Gb/ 500Gb</span>
<br />
<span>- Màn hình: 14.0Inch</span>
<br />
<span>- VGA: VGA rời, Nvidia GT820M 1Gb</span>
<br />
<span>- HĐH: Dos</span>
<br />
<span>- Màu sắc: Black</span>
<br />
<span>Bảo hành: Chính hãng 12 tháng, đổi mới 14 ngày</span>
</a>
</div>
</div>
CSS
/* gradient background hover */
.block {
position: relative;
width: 199px;
height: 253px;
overflow: hidden;
border: 1px solid #ddd;
padding: 10px;
}
.block .content-thumb img {
width: 100%;
max-width: 100%;
}
.block .content-hover {
opacity: 0;
-webkit-transition: all 0.7s ease;
-moz-transition: all 0.7s ease;
-o-transition: all 0.7s ease;
-ms-transition: all 0.7s ease;
transition: all 0.7s ease;
}
.block .content-hover a.link {
position: absolute;
top: 0;
left: 0;
right: auto;
bottom: auto;
width: 100%;
height: 100%;
color: #fff;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#000000+0,d1d1d1+100&0.7+0,1+100 */
background: -moz-linear-gradient(top, rgba(0,0,0,0.7) 0%, rgba(209,209,209,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.7)), color-stop(100%,rgba(209,209,209,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(0,0,0,0.7) 0%,rgba(209,209,209,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(0,0,0,0.7) 0%,rgba(209,209,209,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(0,0,0,0.7) 0%,rgba(209,209,209,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%,rgba(209,209,209,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b3000000', endColorstr='#d1d1d1',GradientType=0 ); /* IE6-9 */
padding: 10px;
}
.block:hover .content-hover {
opacity: 1;
}