Insert html code block inside another

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
leenoble_uk
Forum Contributor
Posts: 108
Joined: Fri May 03, 2002 10:33 am
Location: Cheshire
Contact:

Insert html code block inside another

Post by leenoble_uk »

Here's a challenge for those night owls in need of a procrastination project.
I have a block of HTML which will always consist of at least one paragraph. This is our large block, lets say 300 words.
Now I have a supplemental block contained within a div which is intended to accompany the main block of text. This div element is set to float:right. this block of text is say 70 words. Now I want the supplemental block to float as near to the bottom of the main copy as possible so the html would look something like:

Code: Select all

<p>Some text.....<div>supplemental text</div>some more text</p>
The tricky part is working out where and how to insert the div block into the larger block. As a rough guide, if we say the div box will be 50% of the width then we need to insert the code block roughly the same number of characters back as there are in the supplemental block from the end of the large block. We can use maths to add or remove percentages later.
The other issue is that we can't have the <div> tag beginning in the middle of an existing tag or between existing pairs of tags (except <p>).
Anyone want to accept the challenge?
Post Reply