#home-nav { margin-top: 1rem; } .navpill-background img { width: 100%; height: 100%; object-fit: cover; object-position: center; /* This centers the image */ transition: var(--transition-hover); transition-property: transform; }