WordPress.org

Support

Support » Themes and Templates » [Resolved] Centering image – found solution

[Resolved] Centering image – found solution

  • My previous post was premature as it happens, but I had spent hours trying to work it the problem with no luck. Sometimes it’s what you leave out that solves an issue, rather than what you add.
    In the first banner widget I had an <img> with class ‘alignleft’.
    I needed the image to be center-aligned on mobile. I spent hours trying to work it out how to make it change.
    Finally, a solution arose, if it’s any help to anyone, though it may just be elementary to some. By leaving out the <img class altogether, and having no class at all, just the <img> was a good start. Then put the <img> into a <p> tag. Still aligns left.
    At the end of the stylesheet it’s then possible to add: .banner img {text-align: center;}. worked! The image is centered. Phew!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Centering image – found solution’ is closed to new replies.