c# - Cut a string to fit the width of a div and add three dots at the end of the string -


How can I fit a string into a div's width?

Assume that I have a long string like "Anyone can help me solve this problem" A div 80px wide I want a string To fit the width of the divi and add "..." at the end of one word, as "someone can help me ..."

You use CSS to convert strings to string using methods with elliptic You can try to do

Basically, for this cross-browser to work, you have to use a combination of standard CSS, browser-specific CSS and some XML. The full script can be read on the link above, but the final product is:

  .lispicious {white-space: nowrap; Hidden flurry; Text-overflow: oval; -o-text-overflow: oval; -MOZ-Binding: URL ('Assets / XML / Elysis. XML # Alpicis'); }  

combined

  & lt ;? XML version = "1.0"? & Gt; & Lt; Binding xmlns = "http://www.mozilla.org/xbl" xmlns: xbl = "http://www.mozilla.org/xbl" xmlns: xul = "http://www.mozilla.org/ Keymaster / Gatekeeper / there. This only. Axle "& gt; & Lt; Binding id = "oval" & gt; & Lt; Content & gt; & Lt; Xul: window & gt; & Lt; Xul: description crop = "end" xbl: code = "value = xbl: text" & gt; & Lt; Children / & gt; & Lt; / Xul: Details & gt; & Lt; / Xul: window & gt; & Lt; / Content & gt; & Lt; / Binding & gt; & Lt; / Binding & gt;  

Then decorate your class with CSS class = "ellipsis"


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -