The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

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 ::

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

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed