.sidebar { position: fixed; top: 0; left: 0; z-index: 1; height: 100%; background-color: #fbefd5; overflow-x: hidden; width: 300px; padding: 12px; padding-top: 0px; border-right: 1px solid #222222; font-size: 0.875rem; } @media only screen and (max-width: 600px) { .sidebar { top: initial; bottom: 0; left: 0; height: 45%; width: 100%; } } .close { position: fixed; top: 8px; left: 232px; font-size: 24px; margin-left: 12px; border: none; background: none; cursor: pointer; } @media only screen and (max-width: 600px) { .close { top: calc(55% + 8px); left: initial; right: 12px; } } .close:hover { color: #888888; }