css - 让文本通过一个 div

标签 css

好的,这是一个调查,其中 div 是图表,就像您在 Facebook 上看到的一样。

基本上:

<div style='border:1px solid black;width:300px;'>    
<div style='width:100px;???'>This text is longer than the inner div tag.</div>
</div>

...但我希望文本不会中断并直接通过 div。有人可以帮我解决这个问题吗?

最佳答案

您可以使用white-space: nowrap。确保您的 div 及其相关祖先没有 overflow: hidden 否则您将看不到离开元素的文本。

jsFiddle .

关于css - 让文本通过一个 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10200095/

相关文章:

jquery - Bootstrap 数据表分页样式更改

html - CSS 嵌套列表项和备用背景

html - CSS : Trying to reproduce input with div+input but having a bad top padding

css - 我正在尝试使用 css 在 html 中设置 <select> 标签的样式。它在 Firefox 中正常工作,但在 chrome 中不正常

html - CSS 问题以及如何解决它们

css - Bootstrap 中的多级下拉列表

css - 拨动开关 : Change cursor pointer

CSS 背景大小 > 100% Android 默认浏览器不起作用

css - 无法覆盖输入框溢出

css - 同一容器中的顶部和底部 v 对齐