I am attempting to replicate a piece of a page. The site I am referring to this website.
If you scroll about halfway down on the homepage, you will see green squares. I am trying to do something like that. When you hover over the green boxes you will see they change to purple, the hover effect seems to fade in from the middle and the general theme changes. I am having difficulties trying to get the same effect.
I am running into these issues.
- I am unsure of how to get the fade-in from the middle effect.
- I cannot get my description to change when hovered over.
- I seem to have padding/margin issues between my blocks, but am unsure of where that is coming from since I set the margin/padding to 0.
I appreciate the help.
.box-container {
position: absolute;
width: 100%;
margin: 0;
padding: 0;
}
.blue-box, .red-box {
height: 300px;
width: 25%;
display: inline-block;
padding: 0;
margin: 0;
}
.blue-box:hover, .red-box:hover {
background-color: purple;
cursor: pointer;
}
.blue-box {
background-color: blue;
}
.red-box {
background-color: red;
}
.insideBoxWrap {
padding: 50px 25px;
}
.box-title {
color: #FFF;
font-size: 2.2em;
}
.box-description {
padding-top: 10px;
color: green;
font-size: 1.5em;
}
.box-description:hover {
display: none;
}
.box-description-hover {
display: none;
}
.box-description-hover:hover {
display: block;
color: #000;
font-size: 1.1em;
}
<div class="box-container">
<div class="blue-box">
<div class="insideBoxWrap">
<div class="box-title">Box 1</div>
<div class="box-description">Normal View</div>
<div class="box-description-hover">Hover View</div>
</div>
</div>
<div class="red-box">
<div class="insideBoxWrap">
<div class="box-title">Box 2</div>
<div class="box-description">Normal View</div>
<div class="box-description-hover">Hover View</div>
</div>
</div>
<div class="blue-box">
<div class="insideBoxWrap">
<div class="box-title">Box 3</div>
<div class="box-description">Normal View</div>
<div class="box-description-hover">Hover View</div>
</div>
</div>
<div class="red-box">
<div class="insideBoxWrap">
<div class="box-title">Box 4</div>
<div class="box-description">Normal View</div>
<div class="box-description-hover">Hover View</div>
</div>
</div>
</div>