Support » Fixing WordPress » Aligning an image vertically to the middle of a line of text

  • Resolved TriciaB

    (@triciab)


    I’m using a child theme of twenty twelve and I have a couple of instances where I want to vertically align an image or icon to the middle of the line of text.

    In the original site (I’m just moving it into WordPress), the code is align=”absmiddle”. I’ve tried that and nothing happens. I guess there’s something in the style sheet I need to look at but I don’t want all images to take on this style.

    Any thoughts?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you provide an example webpage where you want a particular image aligned vertically?

    Thread Starter TriciaB

    (@triciab)

    Hi Andrew, I’m working on the site so it’s not all in place but, if you look at the home page, you can see two instances:

    The logo in the body text: it is (logo)

    and also at the bottom the email icon.

    Thread Starter TriciaB

    (@triciab)

    Sorry, forgot the link:

    http://www.communicationandme.com/

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Have you tried the CSS vertical align property?

    img.wp-image-9 {
     vertical-align: middle;
    }

    Thread Starter TriciaB

    (@triciab)

    Yes I did – but should it be in the style sheet? I was trying to style the image in situ

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It should be in your Child Theme stylesheet and your Child Theme stylesheet should be using CSS @import. From what I can see, you’ve just copied the theme’s styles into your Child Theme stylesheet.
    Look at Codex’s guidelines for Child Themes, look at step 3.
    http://codex.wordpress.org/Child_Themes#Example_of_a_basic_Child_Theme

    Thread Starter TriciaB

    (@triciab)

    You’re right – I’ve always done that, then edited the code as I wanted. I didn’t know about the @import.

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Aligning an image vertically to the middle of a line of text’ is closed to new replies.