如何避免内联元素中的换行符? [英] How can i avoid line break in an inline element?

查看:84
本文介绍了如何避免内联元素中的换行符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个带有水平主条目的菜单。在每个相应的子菜单下面垂直显示。现在,一些更长的菜单标题被包裹在几行。实际上,subUL与子菜单中最长的单个字一样宽,所有其他字都相应包装。我没有给UL或LI的宽度(既不是主要也不是子菜单)。

I am building a menu with horizontal main entries. Below each the corresponding submenu titles are displayed vertically. Now, some longer menu titles are wrapped over several lines. Actually, the "sub" UL is just as wide as the longest single word in a submenu and all others are wrapped accordingly. I have given no width for the UL nor the LI (neither main nor sub menu).

所以我的问题是,如何避免打破行?可能我可以用& nbsp; (无空格字符)替换每个空格,但是有不同的方法来实现这一点?

So my question is, how can I avoid breaking lines? Probably I could substitute each space with   (no-space character), but is there a different way to achieve this?

推荐答案

您是否已尝试使用

white-space: nowrap

这篇关于如何避免内联元素中的换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆