:root {
--main-bg-color: darkgoldenrod;
--gr-bg-color: violet;
}
body {
background: var(--main-bg-color);
}
#one, #two {
width: 0;
height: 0;
transition: 2s;
position: absolute;
}
#one {
background: linear-gradient(45deg, var(--gr-bg-color) 50%, var(--main-bg-color) 50%);
left: 200px;
}
#two {
background: linear-gradient(135deg, var(--main-bg-color) 50%, var(--gr-bg-color) 50%);
left: 0;
}
#zero:hover #one {
width: 100px;
height: 100px;
left: 100px;
}
#zero:hover #two {
width: 100px;
height: 100px;
left: 0;
}
<div id="zero" style="background: gray; width: 200px; height: 100px; position: relative;">
<div id="one"></div>
<div id="two"></div>
</div>
body {
margin-top: 100px;
background: darkgoldenrod;
}
#one, #four, #five, #six {
width: 0;
height: 0;
transition: 6s;
position: absolute;
}
#one {
z-index: 999;
background: linear-gradient(45deg, green 50%, transparent 50%);
left: 200px;
}
#four, #five {
right: 0;
top: 0;
width: 100px;
height: 100px;
background: orange;
}
#six4 {
right: 50px;
top: 100px;
width: 50px;
height: 50px;
z-index: -900;
background: green;
}
#two {
right: 100px;
top: 0;
width: 100px;
height: 100px;
background: orange;
display: table-cell;
vertical-align: middle;
text-align: center;
font-size: 24px;
color: green;
font-weight: bold;
}
#zero:hover #one {
width: 50px;
height: 50px;
left: 150px;
}
#zero:hover #four {
width: 50px;
height: 50px;
right: 50px;
top: 50px;
}
#zero:hover #five {
right: 100px;
top: 0px;
width: 50px;
height: 100px;
}
#three {
position: absolute;
right: 0;
top: 0;
transition: 6s;
}
#zero:hover #three {
position: absolute;
right: -50px;
top: 0px;
}
<div id="zero" style="width: 200px; height: 100px; position: relative;">
<div id="one"></div>
<div id="three">
<div id="four"></div>
<div id="five"></div>
</div>
<div id="two">Contact</div>
</div>
W ten sposób można napisać te tło z transparent (ostatni przykład) i nie trzeba definiować "zmiennej CSS".