html - 带有文本溢出的表列 :ellipsis and a number besides

标签 html css

我有一个表格,其中有一列 width: auto。它包含一个文本,当它不适合一列时被省略号缩短。

现在,我想在文本之外附加一个数字。不过,我还是希望文本太长的时候可以缩短,但是数字无论如何都得能看得见。下面是我正在尝试完成的一些示例。

Long name shortened when the column is large Long name shortened when the column is small Short name unchanged

还要求数字始终保持在文本附近。我可以通过设置文本的 div.text { width: 95% } 使其在数字位于固定位置时工作,但这并不完全令人满意。

请看一下 JSFiddle 以获得想法:http://jsfiddle.net/ZRZfk/ . JSFiddle 无法正常工作,因为文本的宽度是固定的。

不使用JS可以解决这个问题吗?

最佳答案

使用max-width代替width Demo

关于html - 带有文本溢出的表列 :ellipsis and a number besides,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22831043/

相关文章:

html - 仅将 css 规则应用于父级

android - Android ListView 中的 HTML 链接

python - 提取正则表达式匹配的一部分

JQuery 移动 slider 句柄(提供 JSFiddle)

html - 如何制作从页面中间开始到页面末尾的内容?

html - 强制用户代理样式表

html - -moz-linear-gradient 不适用于 IE

css - JSF 最后添加自定义 css

html - 将自定义 CSS 添加到 Wordpress 仪表板

html - 使用 flex-direction column reverse 定位粘性