Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
171
rated 0 times [  173] [ 2]  / answers: 1 / hits: 33667  / 12 Years ago, wed, march 14, 2012, 12:00:00

How to hide part of the text inside div or span ?



I have a text of 160 characters but I would like to display only first 40.



I have to have the complete text inside my div, span as I do javascript searches.


More From » html

 Answers
233

You will need some javascript to create a span arround the last 120 characters that hides them. There is a CSS attribute visibility:hidden that can be applied to the span.



Something like that should be the result:



<div>first 40 chars <span style=visibility:hidden>last 120 chars</span></div>

[#86856] Tuesday, March 13, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
devinjadong

Total Points: 711
Total Questions: 117
Total Answers: 100

Location: Andorra
Member since Sat, May 27, 2023
1 Year ago
devinjadong questions
Thu, Feb 17, 22, 00:00, 2 Years ago
Wed, Dec 8, 21, 00:00, 2 Years ago
Tue, Oct 27, 20, 00:00, 4 Years ago
Fri, Oct 18, 19, 00:00, 5 Years ago
;