Floating right an image alongside a H3 tag

I find that images floated right won’t sit alongside a heading tag such as H3. The H3 tag wants to have its own line so it will always appear below the image.

If I put the image also inside the H3 tag then it works but I would prefer to correct this in the CSS somehow as some of our editors aren’t used to delving into the html.

Read More

Is this a standard way that H tags behave? Or is it a quirk of my CSS that I can tweak?

I’m doing this in WordPress using a child theme based on the Thematic theme.

Related posts

Leave a Reply

3 comments

  1. This is a normal behaviour as H tags are block level elements. See this explanation for more information.

    Also note that you can make a block level element not to expand all the width (as it’s normal for a block element), for example if you make it float (and decrease its width), changing its display propery, etc. See this fantastic tutorial for more information.

  2. try putting the h3 tag after the image tag…. they should appear side by side…..

    like this:

    <img src="path/to/some/image" style="float:right;" />
    <h3>some heading</h3>