JSFiddle - React, Tailwind, and code Playground
by karim79
HTML
<div id="home-content">
<div class="view view-sixth">
<img src="http://staples.packagingfinder.net/Images/ProductImages/5_lg.jpg" />
<div class="mask">
<h2>Title 1</h2>
<p>Text for the first box</p>
<a href="page1.php" class="info">More...</a>
</div>
</div>
<div class="view view-sixth">
<img src="http://staples.packagingfinder.net/Images/ProductImages/5_lg.jpg" />
<div class="mask">
<h2>Title 2</h2>
<p>Text for the second box</p>
<a href="page2.php" class="info">More...</a>
</div>
</div>
</div>
CSS
#home-content {
float: left;
position:relative;
width:780px;
margin: 0 auto;
margin-left: 91px;
}
.view {
width: 220px;
height: 220px;
margin: 10px;
float: left;
border: 10px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
-webkit-box-shadow: 1px 1px 2px #e6e6e6;
-moz-box-shadow: 1px 1px 2px #e6e6e6;
box-shadow: 1px 1px 2px #e6e6e6;
cursor: default;
}
.view .mask,.view .content {
width: 220px;
height: 220px;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
}
.view img {
display: block;
position: relative;
}
.view h2 {
text-transform: uppercase;
color: #fff;
text-align: center;
position: relative;
font-size: 17px;
padding: 10px;
background: rgba(0, 0, 0, 0.8);
margin: 80px 0 0 0; /* height from top of square */
}
.view p {
font-family: Georgia, serif;
font-style: italic;
font-size: 12px;
position: relative;
color: #fff;
padding: 10px 20px 20px;
text-align: center;
}
.view a.info {
display: inline-block;
text-decoration: none;
padding: 7px 14px;
background: #000;
color: #fff;
text-transform: uppercase;
-webkit-box-shadow: 0 0 1px #000;
-moz-box-shadow: 0 0 1px #000;
box-shadow: 0 0 1px #000;
}
.view a.info: hover {
-webkit-box-shadow: 0 0 5px #000;
-moz-box-shadow: 0 0 5px #000;
box-shadow: 0 0 5px #000;
}
.view-sixth img {
-webkit-transition: all 0.4s ease-in-out 0.5s;
-moz-transition: all 0.4s ease-in-out 0.5s;
-o-transition: all 0.4s ease-in-out 0.5s;
-ms-transition: all 0.4s ease-in-out 0.5s;
transition: all 0.4s ease-in-out 0.5s;
}
.view-sixth:hover img {
-webkit-transition: all 0.4s ease-in-out 0.5s;
-moz-transition: all 0.4s ease-in-out 0.5s;
-o-transition: all 0.4s ease-in-out 0.5s;
-ms-transition: all 0.4s ease-in-out 0.5s;
transition: all 0.4s ease-in-out 0.5s;
}
.view-sixth .mask {
background-color: rgba(24,24,24,0.5);
...