homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Wrapping Text around images with arbitrary locations

10+ Year Member

Msg#: 819 posted 7:36 pm on Mar 31, 2003 (gmt 0)

Hey everyone --

I've searched high and low, and I can't find any indication of whether this can be done or not.

To put it in context, consider that I have an XML page, which defines a) a block of text and b) any number of images and a location where they should go. (ie and x/y coordinate).

That aspect works fine. However, I want to display the block of text, and then the images placed within the text, at the locations that are indicated.

Just setting the position puts the images down in the right places, but overlapping the text. I want to see the text wrap around -- so the page looks natural.

I've tried some other ideas in the forum, but they all seem to rely on putting the image tag in the correct place. I want to be able to put all my image tags in the same place, only with different positions marked on each

Anyone tried this? Or is it beyond the ability of CSS?




WebmasterWorld Administrator lorax us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 819 posted 9:16 pm on Mar 31, 2003 (gmt 0)

Are you using XSLT or parsing the XML with a script file and then applying CSS?

BTW - Welcome to WebmasterWorld!


10+ Year Member

Msg#: 819 posted 10:21 pm on Mar 31, 2003 (gmt 0)

Thanks for the welcome, Lorax.

I'm using XSLT.

But, I'm thinking it should work exactly the same way whether I'm bringing this information in through an XML file, or if I just sit down and write a static HTML file.


WebmasterWorld Senior Member 10+ Year Member

Msg#: 819 posted 3:38 am on Apr 1, 2003 (gmt 0)

Sorry, but I'm pretty sure that this is beyond the ability of CSS. Using absolute positioning on the images removes them from the normal text flow, which is why the text overlaps them. And you can't float an element that uses absolute positioning.

Plus I don't even think its possible to have an image where text wraps around both sides of it (even with the img tag in the right place). You have to either float:left or right, there doesn't seem to be a way to float:middle.


10+ Year Member

Msg#: 819 posted 1:06 pm on Apr 1, 2003 (gmt 0)

Hey grahamstewart --

I think you're right. I was pretty sure exactly what I wanted to do wouldn't be possible when I posted, but I wanted to make sure.

I'm thinking I may be able to allow a certain number of images to be defined, with locations like 'top right', 'bottom' and 'bottom right' or something along those lines. It allows for some flexibility, but still creates a firmer template.



WebmasterWorld Senior Member 10+ Year Member

Msg#: 819 posted 2:03 am on Apr 2, 2003 (gmt 0)

Just a thought, the browser expects img tags to be amongst the text, so why fight it?

Surely if the image is related to the text in some way then the structure of your document should reflect this?

I can see why you might want all the images together for xml, but can't you alter the ordering via xslt? (I don't know I've never really played with it)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved