Do you know the code for this problem? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Do you know the code for this problem?

I dont know how to descrip my question so i just use that. back to the main question, i want to make every title on my blog just two line, if the title is still not enough for two line the css will break it automaticly. Just like every title video of youtube mobile version. i already try with this code "white-space:nowrap;text-overflow:ellipsis;overflow:hidden" or white-space:pre/pre-line/pre-wap but its still doesn't work. do you know the right code is? sorry for my bad english.

17th Aug 2016, 10:19 AM
Rizal
3 Answers
0
Have you tried white-space:pre; ?
17th Aug 2016, 10:55 AM
Unai Mengual
Unai Mengual - avatar
0
i already haved, and still doesnt work
17th Aug 2016, 10:59 AM
Rizal
0
if u r doing it in CSS you might get browser incompatibility issue try this with JavaScript its much easier ex <h1 id="h1">sdhhhjjfdckkitf and so on<\h1> var h1 = document.getElementById('h1').innerHTML; var newh1 = h1.substring (0,50); h1.innerHTML=newh1+'...'; I have not tested this code but it should work fine.
18th Aug 2016, 5:13 PM
Manish Pandey
Manish Pandey - avatar