margin 0 auto not centering


I can’t emphasize enough how important the margin is. The margin is the space around the image. You want the image to be centered on the page. If you don’t have enough room, you have to crop. If you don’t know how to crop a photo, check out my article on how to crop photos. One rule of thumb is to make sure that all your content is centred on its page.

One of the reasons that Google favours images that are at least 1/3 of the full width of the page is so that they can be used effectively in links. If you have content that is less than 1/3 of the full width of the page, you can crop it to fit.

You can also crop an image to be centred by adding a margin of 0 to the top and left of the image. The margin is there to take into account that there are other elements on the page that may not be in the same column as the image. If you don’t know how to crop photos, check out my article on how to crop photos.

margin 0 auto is not centering when you use it. This is because the margin is applied to the width of the elements that are of the same line, in this case, the text. I usually use this technique when I know that text will be different widths.

I used it when I wanted to use a specific background image on my blog, and I was using a background image from an image file that was different sizes and I didn’t want to stretch the image vertically to fill the entire height of my blog. I used margin 0 auto with my images. This is a nice trick to know when you want to center an image.

margin 0 auto is actually less than the width of the element. So if you want to center an image, you have to use a different technique. For example, if you have an image like this one of my kids playing with a toy train, you can use margin-top instead of margin-top: 0.5ex.

How about setting an image to be less than it is and have it be centered, as the margin-top margin in my case, instead of 0.5ex.

Also, margin-top works for all elements and is more versatile than margin-bottom. This is not to say that margin-bottom is always better though. Margin-bottom 0.5ex is the most I’ve used it and I haven’t noticed much difference.

Previous Post
travis pattern and foundry
Next Post
advanced styling


Leave a Reply

15 49.0138 8.38624 1 0 4000 1 300 0