• Resolved starwag

    (@starwag)


    When I place images in posts, the alignment tool won’t work. All images remain aligned left. I know this is a common problem, and I’ve already checked this problem out on other similar support questions. The following code seems to be the preferred fix, but I have tried this both in tandem with the code I already have for images, and without my code, using only the code below alone to style images, and neither way seems to work.

    This may be a fix for other people, but not for me. Does anyone have any other suggestions how to fix this? (the page I linked has a bottom image that should be center aligned, but isn’t).

    The code I previously tried to fix this problem with.

    
    .wp-block-image .aligncenter, .wp-block-image .alignleft, .wp-block-image .alignright, .wp-block-image.is-resized {
    display: block;
    text-align:center!important;
    }
    

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Joy

    (@joyously)

    I think you have bigger issues than image alignment. I couldn’t even tell what image you were referring to. Perhaps you should ask in your theme’s support forum.
    Here is what I saw:

    Thread Starter starwag

    (@starwag)

    Does anyone have anything helpful to add to the question I asked?

    • This reply was modified 7 years ago by starwag.
    rodrigovaleriano

    (@rodrigovaleriano)

    Hello
    Try to use the following code:

    .wp-block-image .aligncenter, .wp-block-image .alignleft, .wp-block-image .alignright, .wp-block-image.is-resized {
    display: block;
    Width:100%; /*exemple*/
    margin: 0 auto !important;
    }

    [link removed]

    Thanks

    Thread Starter starwag

    (@starwag)

    Thanks for trying to help, but I discovered I was missing some essential CSS that works with WordPress. For anyone else out there who has similar issues, and is working on their developer skills, the code below is what you absolutely need in your theme’s stylesheet for images to work. Rookie mistake, but definitely available in WordPress’s Codex, which includes lots of other essential info. It took a bit more digging. You can find the codex here WP Codex I hope this saves someone else some time.

    img.alignright {float:right; margin:0 0 1em 1em}
    img.alignleft {float:left; margin:0 1em 1em 0}
    img.aligncenter {display: block; margin-left: auto; margin-right: auto}
    a img.alignright {float:right; margin:0 0 1em 1em}
    a img.alignleft {float:left; margin:0 1em 1em 0}
    a img.aligncenter {display: block; margin-left: auto; margin-right: auto}
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Alignment in Post’ is closed to new replies.