Forum Moderators: not2easy

Message Too Old, No Replies

Floated image bumps to new line

Floated image keeps bumping to a new line when trying to align right

         

mikegioia

4:39 am on Dec 22, 2007 (gmt 0)

10+ Year Member



Hi guys -

This has been driving me nuts. I'm trying to align an image to the right, with text on the left. Right now, there isn't any CSS being applied to the image, just an align="right". Here's the HTML:

<div style="background: #E2E2E2;">
<span>Saved Resumes and here is more text to see what the wrapping looks like here so that i can see what the wrapping looks like</span>
<img align="right" src="/images/new-resume.png" width="150" height="32" alt="" />
</div>

If anyone could help me here and show me what I'm doing wrong, I'd really appreciate it.

Thanks,
Mike

[edited by: SuzyUK at 9:46 am (utc) on Jan. 2, 2008]
[edit reason] no screenshots, thanks [/edit]

SuzyUK

9:54 am on Jan 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi mikegioia, and Welcome to WebmasterWorld!

by aligning an image to the right you are in effect floating it. Floated content should appear before the content you are trying to make wrap, just change the source to make the image come before the span and all should be well.

Xapti

4:12 pm on Jan 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The align attribute for html is depreciated, so you may not want to use it. Here is some information regarding it by the W3C:
[w3.org...]

<div><img style="float:right"><span>text</span></div>
Would be a good way to do it, but it's possible you don't even need the span around the text. Spans are generally used if you need to apply a style to a specific section of inline content... such as a different font family and text color. If everything inside the div (other than the image(s)) is the same as what's in the span, then you don't need it.