Welcome to WebmasterWorld Guest from 107.22.87.145

Forum Moderators: not2easy

Message Too Old, No Replies

Wrapping Text around images with arbitrary locations

     
7:36 pm on Mar 31, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 31, 2003
posts:3
votes: 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?

Thanks.

9:16 pm on Mar 31, 2003 (gmt 0)

Senior Member from US 

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

joined:Mar 31, 2002
posts:7575
votes: 0


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

BTW - Welcome to WebmasterWorld!

10:21 pm on Mar 31, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 31, 2003
posts:3
votes: 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.

3:38 am on Apr 1, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 8, 2003
posts:1429
votes: 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.

1:06 pm on Apr 1, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 31, 2003
posts:3
votes: 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.

Thanks!

2:03 am on Apr 2, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 8, 2003
posts:1429
votes: 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)