The CSS margin property controls the space between different HTML elements on a webpage. Use margin to bring page elements closer together or to move them further apart.

The CSS below ensures 2rems of space between elements with the class answer and surrounding page elements.

.answer { margin: 2rem; }



In main.css, locate the .gallery-item class selector. Currently, it has a margin of 2px. Change the value to 20px.

Run your code to see the space increase between each gallery item.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?