?
Solved

floating image after text even when the text wraps

Posted on 2014-01-08
2
Medium Priority
?
199 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
[X]
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
2 Comments
 
LVL 8

Accepted Solution

by:
Adrian Crabtree earned 1000 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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Suggested Courses

764 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