Reputation: 13
I have problem with CSS with two divs. My first div contain texts while second div contains images. I need to put the image div in top right corner of text div.
My div structures as below:
<div class="text">text text text .... more text</div>
<div class="images">image image</div>
I want to archieve this:
========================
text text - image -
text text - image -
text text text text
text text text text
text text text text
=========================
I illustred this problem with an image:
How to achieve this?
Upvotes: 0
Views: 594
Reputation: 174957
<style>.images { float: right; }</style>
<div class="images">image image</div>
<div class="text">text text text .... more text</div>
Live Example - This example demonstrates the principle. It has more styles to make it look nicer, but it will work without them. Play with it and see what I mean.
Upvotes: 3
Reputation: 3000
If you reformat the HTML to put the images in the text , you can float the images within that container and the text will flow around it.
<style>
img { float:right; }
</style>
<div>
<img src="image1.png">
<img src="image1.png">
Lorum ipsum .....
</div>
Placing the images into a different container means they're 'separated' from that text, so the text can't flow.
Upvotes: 2