I have this web page layout where I want the text be right of the image but if by height the text expands It wont overflow to the left side below the image like so:
My code looks like so:
<div class="content py-2 px-10">
<img class="w-48 h-48 float-left " src="#" alt="">
<div class="item-body ">
lorem ...
</div>
</div>
I am using float-left on my image which lets the text reside on the right, but if the text goes further from the image height it goes below the image like so:
I tried adding float-right
to my item body but then the whole text went below my image.
I tried adding the clear
attribute but nothing seems to do the thing.
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet"/>
<div class="content flex py-2">
<img class="w-48 h-48" src="#" alt="">
<div class="item-body px-2 ">
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
</div>
</div>
Please remove float-left
class from image & add flex
class to your parent div
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With