#gallery-container{ background-color: #222023; height: auto; display: flex; flex-direction: row; flex-wrap: wrap; align-items: top; padding-bottom: 3%; justify-content: space-around; } #gallerythumb{ margin-left: 1%; margin-right: 1%; margin-top: 3%; padding: 1%; width: 100%; max-width: 160px; border: 1px dotted white; text-align: center; background-color: black; } #thumbnail{ width: 100%; max-width: 150px; display: block; margin-left: auto; margin-right:auto; }