I have a long text and I want to hide that part if it is longer than the div.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Set the div with a width or height, (otherwise it won’t know whether something is overflowing). Then, add the
overflow:hidden;CSS property-value pair.If using IE, remember to position the element relative so that IE knows how to deal with it.
I wouldn’t use ellipsis, as its not fully cross-browser compatible
Demo is here http://jsfiddle.net/vxN8v/1/