Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

floating image after text even when the text wraps

Posted on 2014-01-08
2
191 Views
Last Modified: 2014-01-15
Hi,

I need an image to float right of a headline even when the text in the headline wraps onto another line.

<div style="width:100px">
<h3 style="float: left">headline text</h3>
<span stlye="float:left">background image placeholder</span>
</div>

At the moment I am having issues if the text wraps onto a new line the image no longer sits to the right of the text but instead sits underneath it. If the text is in one line it looks fine.

Thanks


Attached is a schematic example of what I need
example.jpg
0
Comment
Question by:Al4ddin2
2 Comments
 
LVL 8

Accepted Solution

by:
Adrian Crabtree earned 250 total points
ID: 39765965
Hi Al4ddin2, you can try setting the H3 to a display: inline. Here's a pen I created to illustrate that idea.

http://codepen.io/anon/pen/Dykuh
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 250 total points
ID: 39765969
Since you are setting the container to width:100px there is no room for the image to float next to the text. An inline element will take up as much room as it needs - in this case the whole 100px before wrapping.
To get them on the same line you need to give the H3 tag a set width that allows enough room for the image to fit into the remaining width of the container
e.g.
http://jsfiddle.net/b9MCs/4/
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question