如何避免两行中的跨度中断内容? [英] How to avoid content of span break in two lines?

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

问题描述

我有以下 jsFiddle 。当我调整窗口大小时,跨度被分成两行。我如何防止这种情况发生?我希望整个跨度到第二行。

I have the following jsFiddle. When I resize the window the span is broken into two lines. How do I prevent that? I want the whole span to go to the second line.

<html>
    <body>
        <div id="dvContainer">
            <span style="border:1px;border-style:solid;margin-right:5px;padding:5px;">some text for the first span</span>
            <span style="border:1px;border-style:solid;margin-right:5px;padding:5px;">second text for second span</span>
        </div>
    </body>
</html>

编辑:

接下来我需要他们但是当我调整屏幕的大小时,我希望整个div都可以打破这一行,谢谢

I need them next to each other, but when I resize the screen I want the whole div to break the line, thanks

推荐答案

你可以使用nowrap :

You can use nowrap:

span{
  white-space: nowrap;
}

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

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