freeCodeCamp's Center an Element Horizontally Using the margin Property, Applied Visual Design

Lesson Summary

Learning to center an element using the margin property is an important tool to have access to in your toolset. Using the margin property and giving it a value of "auto" will center our element horizontally. We can apply these same settings to images. Since images are inline elements, we would also need to change the image's display property to block.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required