Forums

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

Home Forums CSS Vertically center an img adjacent to text – minus margin query

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #42239
    MikeWD
    Member

    I often use this method to keep an image vertically centered along side some text. I was wondering if there are any alternative ways to do this, the minus margin-top value does not sit well with me, plus if the image size changes the pixel value must be calucated again as margin-top: -50%; doesn’t work correctly (probarbly due to my lack of knowlege on vertical height with percentages).

    note: the main reason for this method is if more text is added, the img remains vertically centered.

    http://codepen.io/dntz/pen/trJDy

    Thanks in advance.

    #122253
    Paulie_D
    Member

    A little extra mark-up but: http://codepen.io/anon/pen/aAuoj

    #122271
    MikeWD
    Member

    thanks for that Paulie, would that be the optimal way to preform this task?

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