Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如果CSS或Asp.net中的文本太宽,则剪切文本_Asp.net_Css_Width_Word Wrap - Fatal编程技术网

如果CSS或Asp.net中的文本太宽,则剪切文本

如果CSS或Asp.net中的文本太宽,则剪切文本,asp.net,css,width,word-wrap,Asp.net,Css,Width,Word Wrap,我将此文本放在一个固定宽度的div中: Some headline (2009-10-10 small) Some headline (2009-10-10 small) Some headline (2009-10-10 large) 但当标题太宽时,结果是: Some headline (2009-10-10 small) Some wide headline (2009-10-10 large) Some headline (2009-10-10 large) 我真正想要的是: Som

我将此文本放在一个固定宽度的div中:

Some headline (2009-10-10 small)
Some headline (2009-10-10 small)
Some headline (2009-10-10 large)
但当标题太宽时,结果是:

Some headline (2009-10-10 small)
Some wide headline (2009-10-10
large)
Some headline (2009-10-10 large)
我真正想要的是:

Some headline (2009-10-10 small)
Some wide... (2009-10-10 large)
Some headline (2009-10-10 large)

这可以通过Asp.net和CSS实现吗?我知道我可以在Asp.net中测量字符串宽度,但它(据我所知)不是很精确。

如果文本超过某个可视长度,则需要截断文本。CSS可以用来隐藏超出的字符,但截断必须在代码级别(服务器大小或javascript)完成

如果您试图按字符数翻转字体,这可能有点棘手,除非您使用的是固定宽度字体。或者,您可以尝试更保守的最大字符数


我确信还有更多创造性的方法,我渴望听到其他人的声音。

这就是我使用mootools的方式:


调整浏览器的大小,看看神奇之处。

Hhm,我将尝试保守的方法。