Grow your CSS skills. Land your dream job.

How to center an image inside a H2 tag

  • # July 12, 2013 at 2:25 am

    how do i center an image inside a h2 tag ? i need it to float left and to be centered

    Thanks in advance

    # July 12, 2013 at 2:35 am

    That sounds a bit hacky and unnecessary ? Could you show us how you plan on using this ?

    # July 12, 2013 at 7:24 am

    Float left **and** centered?

    Does not compute.

    # July 12, 2013 at 2:36 pm

    Do you mean vertically aligned to the center (preferably “middle”)? With an image as a child of an h2 element? You can do that with vertical-align applied to the image. Here’s a pen with a few vertical-align values and what they look like :: http://cdpn.io/dvDxy

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".