在 html 中停止自动换行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3658753/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 04:25:07  来源:igfitidea点击:

Stop word-wrap in html

htmlcss

提问by Kali Charan Rajput

I don't want word wrap but this is being. I have set width more than text length but this is still breaking so how can I stop word break.

我不想要自动换行,但这就是存在。我设置的宽度大于文本长度,但这仍然会中断,所以我该如何停止断字。

css

css

.menu{
    float:left;
    width:120px;
    height:34px;
    padding:12px 6px 0 6px;
    color:#cc8d50;

}

回答by Kyle

Try:

尝试:

.menu{
    white-space: nowrap;
...

Add that to your CSS.

将其添加到您的 CSS 中。

回答by mkoistinen

In your css insert this:

在你的 css 中插入:

white-space:nowrap;

空白:nowrap;