The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS display: block; margin problems? Am I being silly?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #36014

    Hello there,

    CSS-Tricks and its members are amazing… Just getting that out there. Great resource for people who are wanting to learn.


    I’m trying to center an image and am using the display: block; margin-right: auto; margin-left: auto; method.

    Whenever I stack two of these centered images on top of each other, the top and bottom margins seem to not make sense? Is there a way to set consistant top and bottom margins?

    Oh and I have another quick question… When aligning an image to the left in WordPress, how would you go about preventing text from wrapping around on the right hand side without inserting clear after every image?

    Any help would be greatly appreciated.

    Thanks. :)


    Thanks for the reply cnwtx.

    I have tried that and still no luck.

    If you have a look here: you will see what I mean.


    Perhaps you mean that the margin between two images is more than the margin between an image and text above or below the image?

    I notice you have a
    element between each image. That is blowing extra space between you images. Your

    elements appear to have no margin at all, I’m not sure what you are looking for, but those are the places I see possible culprits for unexpected styling issues.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.