2

In my css,i write a class style overflow : hidden.My div contains a small image and some paragraph text. if the overflow is hidden in the sense the word wrap doesn't work. if i remove,it works. but i need both overflow hidden and also word wrap.

.img-block_100 { height: 100px; width: 100px; float: left; margin-right: 5px; } .img-block_100 img { max-width: 100%; } .ee-content { width: 100%; height: 140px; overflow: hidden; width: 250px; } 

please see what i tried: Demo

4
  • What exactly isn't working? Commented Mar 17, 2015 at 14:27
  • @APAD1 Try removing overflow: hidden, then you will see. Commented Mar 17, 2015 at 14:27
  • If I remove overflow:hidden; the full text becomes visible, as would be expected. Commented Mar 17, 2015 at 14:29
  • 1
    @APAD1 : i need overflow:hidden; and wrap text both Commented Mar 17, 2015 at 14:30

1 Answer 1

2

It's because overflow: hidden was clearing the floated img element.

One solution would be to wrap both of the elements and then add overflow: hidden to the wrapper. In doing so, the floated img isn't being cleared, and the text wraps around the img as expected.

Example Here

.content-wrapper { width: 250px; height: 140px; overflow: hidden; } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.