#centering image in grid

3 messages · Page 1 of 1 (latest)

floral lava
#

I'm trying to create a light border around my images within each blog post (each one is a square in a grid. Problem is, in order to get the image to be centered within the blog post, I need to set the left and right margins to auto, so by setting the image to
margin: 1rem auto;
I can only get the border to show up on the top and bottom of the image. Any ideas? text-align: center didn't work

rotund sleet
#

Presuming that everything in that blue border is contained in some sort of containing element (e.g. a div) then you could set some padding left and right on that div to push those borders in. If that doesn't work could you try posting a link to your code?

floral lava
#

@rotund sleetI don't know why I didn't think of that... worked perfectly. Thank you!