问题标签 [nowrap]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
13 回答
386437 浏览

html - 如何使 DIV 不换行?

我需要创建一个包含多个其他 DIV 的容器 DIV 样式。如果将浏览器窗口调整为窄,则要求这些 DIV 不会换行。

我试图让它像下面那样工作。

这在大多数情况下都有效。但是,在某些特殊情况下,渲染是不正确的。我在IE7的RTL中发现容器DIV更改为3000px宽度;它变得一团糟。

有没有其他方法可以使容器 DIV 不包装?

0 投票
4 回答
1653 浏览

html - IE6 nowrap 和浮动问题

这让我发疯...

在所有其他浏览器中,文本浮动在蓝色框之后。然而,在 IE6 中(有点可预见),文本会低于蓝色框。

...我只是找不到答案。文本不能换行,因此没有换行。


-- 随机添加这个会使蓝框完全消失

0 投票
3 回答
69680 浏览

html - 使一段文本不中断?

说我有这样一段文字

你好我是一些文字你好我是一些文字你好我是一些文字你好我是一些文字我不希望换行

考虑上面的段落。如果可能的话,我希望粗体部分不要跨越新行。如,如果它需要滚动条或其他东西,我希望它中断,但如果可以在那段文本之前或之后插入分页符,以便它可以放在一行上,则不要中断。

这怎么可能?我已经尝试过诸如此类的事情page-break-inside,但它似乎在Firefox中没有做任何事情。

0 投票
2 回答
2302 浏览

html - 带有 nowrap 的元素会卡在 WebKit 中的相邻元素上

我有一个ul显示为水平菜单的列表。我希望每个项目的内容都li保留在一行上,但整个li项目会根据需要跳行。就像是:

First entry in the menu Second menu entry
These words are short, the LI jumps lines, but doesn't wrap
Yet anoter] [And more] [Some more]

从逻辑上讲,我只是放了li {white-space:nowrap;},但是 WebKit 浏览器存在问题。带有 nowrap 的物品会粘在相邻的物品上。所以在上面的例子中,所有的li都将在同一行。

nowrap对于带有环绕文本块的独立元素也是如此。

我期望的是这样的:

访问我的网站Gabriel Radic .com
Timbru 博客

相反,这两个链接最终粘在一起,例如:

访问我的网站
Gabriel Radic .comTimbru 博客(罗马尼亚语)

有没有什么好办法让 Safari、Chrome 和其他人停止抓人的手肘?

谢谢你的帮助。

0 投票
1 回答
1650 浏览

android - Android:TextView 中 Spannable 中的“nowrap”

是否有可能在 TextView 中具有类似于 WebView 中的此功能的跨度?

我试图避免

我宁愿

0 投票
3 回答
5991 浏览

css - 用于孩子但不是父母的空白 nowrap css

我有一个内部有多个跨度的 div。跨度包含不能分成多行的文本,因此我设置了空格:nowrap。这确实会正确停止每个子跨度内的包装,但也会阻止父 div 包装子级,因此所有跨度都位于从页面延伸的单行上。

如何更改此行为,以便 nowrap 仅适用于每个跨度的内容?

0 投票
3 回答
16235 浏览

css - CSS white-space nowrap doesn't increase width?

I am reconstructing a dropdown menu similar to a <select> box using div's and jquery. The div containing the dropdown items should have a minimum width, but no maximum width as it should grow along with the widest item in the list (so if i have very long item like '[This is the longest item within the container]', the whole container should be as wide as this entry.

Now I almost got what I want, using white-space:nowrap for each item within the container, so that the text of an item won't continue on a new line. The problem using is the text flows out of the box using, instead of letting the box grow along the text. I can't figure out how to fix this problem. I already tried text-overflow:ellipsis but that appears to just hide the overflown text and adding three dots (...) at the end.

So here is my problem in a nutshell: how can I let a div grow along with the text inside of it, when white-space:nowrap is applied on it, instead of letting the text flow out of it? I don't want to hide the text using overflow:hidden, I want to show the entire string..

Thanks in advance!

0 投票
2 回答
1180 浏览

php - DIV 溢出/滚动条/chrome/ff/ie

希望对某人来说是一个很好的简单问题:)

我有一个照片画廊带,它在上面的 DIV 中加载了一个主图像。画廊条在 Chrome 中看起来很好,但在 IE 和 FF 中没有出现滚动条,并且画廊垂直展开,有人可以帮忙吗?提前致谢!:)

这是页面 http://www.militarysilver.co.uk/military-silversmith-gallery.php

非常感谢,丹

0 投票
3 回答
1669 浏览

html - 如何制作没有换行且没有水平滚动的表格

我有一个有 8 列的表。第 3 列和第 4 列可能有很长的文本。这种情况会产生水平滚动。我想要的是我希望每一列都有一个固定的大小,我不希望列内的文本被包装,也不希望有滚动条。因此,如果一列有一个很长的字符串,例如“abcdefghijklmnop”,它应该尽可能多地显示,而不需要换行和创建滚动。所以在桌子上看到的文字可能类似于“abcdefg”

实际上我正在尝试在 Eclipse BIRT 中执行此操作,但如果我可以学习如何在 html 和 CSS 中进行此操作就足够了。然后我可以将它用于 BIRT。顺便说一句,我不想​​用 Javascript 检查文本的大小。

0 投票
1 回答
12463 浏览

css - css white-space:nowrap 水平滚动错误

我有以下标记

当浏览器足够宽时,它看起来像这样 宽的

当浏览器变窄时,它看起来像这样 狭窄

当我滚动时,我希望窄视图的灰色背景一直向右延伸。我的标记和 css 会导致这种不良影响(发生在 Chrome、FF3 和 IE8 中)