.staff-heading{ text-align: center; margin-bottom: 30px; margin-top: -30px; } .staff{ width: 90%; display: flex; align-items: center; justify-content: space-around; margin-bottom: 40px; } .staff .img-wrapper{ flex: 1; display: flex; margin: auto; } .staff .img-wrapper img{ height: 100%; width: 100%; object-fit: cover; display: flex; align-items: center; justify-content: center; } /* class with diffrent flex-diraction */ .staffSwap{ width: 90%; display: flex; align-items: center; justify-content: space-around; margin-bottom: 40px; flex-direction: row-reverse; } .staffSwap .img-wrapper{ flex: 1; display: flex; margin: auto; } .staffSwap .img-wrapper img{ height: 100%; width: 100%; object-fit: cover; display: flex; align-items: center; justify-content: center; } .staff-info{ flex:1; text-align: center; } @media only screen and (max-width: 413px) { .staffSwap{ flex-direction: column; border-bottom: 1px solid var(--yellow); padding-bottom: 20px; } .staff{ flex-direction: column; border-bottom: 1px solid var(--yellow); } }