.main { height: 100%; position: absolute; z-index: 1; left: 3%; right: 3%; } .tab-yes { height: 100%; width: 3%; float: left; position: fixed; z-index: -1; left: 0; background: var(--yes); } .tab-no { height: 100%; width: 3%; float: right; position: fixed; z-index: -1; right: 0; background: var(--no); } .tab-yes:hover { width: 4%; transition: 0.2s; } .tab-no:hover { width: 4%; transition: 0.2s; } .tab-yes:hover ~ .main { left: 5%; transition: 0.2s; } .tab-no:hover ~ .main { right: 5%; transition: 0.2s; } .post { background: white; border-radius: 14px; padding: 1rem; margin: 1rem; width: 20%; } .post:hover { background: linear-gradient(to left, var(--no) 50%, var(--yes) 50%); cursor: pointer; transition: 0.8s; color: white; }