:root { --cap-y-offset: 3px; } #header-container { width: 100%; display: flex; justify-content: center; margin-bottom: 60px; padding: 0; } .header { display: flex; flex-direction: column; align-items: center; width: 100%; margin: 0; padding: 0; position: relative; height: 100px; } .header .logo { width: 300px; height: auto; display: block; position: relative; z-index: 5; } .header::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; z-index: 1; } .header-end-cap { width: 100%; height: auto; display: block; position: absolute; top: 100%; left: 0; transform: translateY(calc(-50% + var(--cap-y-offset))); z-index: 4; } @media screen and (max-width: 768px) { .header { height: 90px; } .header .logo { width: 260px; } #header-container { margin-bottom: 50px; } .header-end-cap { width: 100% !important; min-width: 100%; } }