What is the best way for this to be written where the blue heart fades in over the red one?
code
https://jsfiddle.net/7mgz1ax2/
Should I not have done this?
I’m confused on how to do this.
.heart-piece-0,
.heart-piece-a{
left: 0;
height: 30px;
top: -15px;
background-color: #0059dd;
}
css
.heart {
position: relative;
width: 138px;
height: 33px;
opacity: 0;
}
.heartb {
position: relative;
width: 138px;
height: 33px;
}
[class*="heart-piece-"] {
position: absolute;
top: -5px;
width: 10px;
height: 10px;
border-radius: 5px;
}
.heart-piece-0,
.heart-piece-a{
left: 0;
height: 30px;
top: -15px;
background-color: #0059dd;
}
.heart-piece-1,
.heart-piece-b{
left: 16px;
height: 60px;
top: -31px;
background-color: #0059dd;
}
.heart-piece-2,
.heart-piece-c{
left: 32px;
height: 80px;
top: -37px;
background-color: #0059dd;
}
.heart-piece-3,
.heart-piece-d{
left: 48px;
height: 90px;
top: -31px;
background-color: #0059dd;
}
.heart-piece-4,
.heart-piece-e{
left: 64px;
height: 94px;
top: -23px;
background-color: #0059dd;
}
.heart-piece-5,
.heart-piece-f{
left: 80px;
height: 90px;
top: -31px;
background-color: #0059dd;
}
.heart-piece-6,
.heart-piece-g{
left: 96px;
height: 80px;
top: -37px;
background-color: #0059dd;
}
.heart-piece-7,
.heart-piece-h{
left: 112px;
height: 60px;
top: -31px;
background-color: #0059dd;
}
.heart-piece-8,
.heart-piece-i{
left: 128px;
height: 30px;
top: -15px;
background-color: #0059dd;
}
.heart-piece-a {
background-color: red;
}
.heart-piece-b {
background-color: red;
}
.heart-piece-c {
background-color: red;
}
.heart-piece-d {
background-color: red;
}
.heart-piece-e {
background-color: red;
}
.heart-piece-f {
background-color: red;
}
.heart-piece-g {
background-color: red;
}
.heart-piece-h {
background-color: red;
}
.heart-piece-i {
background-color: red;
}
html
<div class="heart ">
<div class="heart-piece-0"></div>
<div class="heart-piece-1"></div>
<div class="heart-piece-2"></div>
<div class="heart-piece-3"></div>
<div class="heart-piece-4"></div>
<div class="heart-piece-5"></div>
<div class="heart-piece-6"></div>
<div class="heart-piece-7"></div>
<div class="heart-piece-8"></div>
</div>
<div class="heartb ">
<div class="heart-piece-a"></div>
<div class="heart-piece-b"></div>
<div class="heart-piece-c"></div>
<div class="heart-piece-d"></div>
<div class="heart-piece-e"></div>
<div class="heart-piece-f"></div>
<div class="heart-piece-g"></div>
<div class="heart-piece-h"></div>
<div class="heart-piece-i"></div>
</div>
Here I put it back this way: https://jsfiddle.net/690g4psd/
.heart-piece-a {
left: 0;
height: 30px;
top: -15px;
background-color: red;
}
.heart-piece-b {
left: 16px;
height: 60px;
top: -31px;
background-color: red;
}
.heart-piece-c {
left: 32px;
height: 80px;
top: -37px;
background-color: red;
}
.heart-piece-d {
left: 48px;
height: 90px;
top: -31px;
background-color: red;
}
.heart-piece-e {
left: 64px;
height: 94px;
top: -23px;
background-color: red;
}
.heart-piece-f {
left: 80px;
height: 90px;
top: -31px;
background-color: red;
}
.heart-piece-g {
left: 96px;
height: 80px;
top: -37px;
background-color: red;
}
.heart-piece-h {
left: 112px;
height: 60px;
top: -31px;
background-color: red;
}
.heart-piece-i {
left: 128px;
height: 30px;
top: -15px;
background-color: red;
}