防止跨度元素换行 [英] Prevent line-break of span element

查看:151
本文介绍了防止跨度元素换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个< span> 元素,我想显示没有换行符。


b b b b b b b b b pre> white-space:nowrap;

获取更多信息:http://www.w3.org/wiki/CSS/Properties/white-space



white-空格



white-space属性声明元素中的空格处理方式。





正常
此值指示用户代理折叠空格序列,根据需要填充行框。



pre
此值防止用户代理折叠序列的白色空间。行只在源中的换行符或在生成的内容中出现\A​​时被破坏。



nowrap
此值会折叠空格,与normal相同,但会禁止文本中的换行符。



pre-wrap
此值防止用户代理折叠空白序列。



在源代码中的换行符,在生成的内容中出现的\A pre-line
此值指示用户代理折叠空白序列。



在源代码中的换行符,在生成的内容中出现的\A inherit
采用与元素父元素的属性相同的指定值。


I have a <span> element which I want to display without any line break. How can I do that?

解决方案

Put this in your CSS:

white-space:nowrap;

Get more information here: http://www.w3.org/wiki/CSS/Properties/white-space

white-space

The white-space property declares how white space inside the element is handled.

Values

normal This value directs user agents to collapse sequences of white space, and break lines as necessary to fill line boxes.

pre This value prevents user agents from collapsing sequences of white space. Lines are only broken at newlines in the source, or at occurrences of "\A" in generated content.

nowrap This value collapses white space as for 'normal', but suppresses line breaks within text.

pre-wrap This value prevents user agents from collapsing sequences of white space. Lines are broken at newlines in the source, at occurrences of "\A" in generated content, and as necessary to fill line boxes.

pre-line This value directs user agents to collapse sequences of white space. Lines are broken at newlines in the source, at occurrences of "\A" in generated content, and as necessary to fill line boxes.

inherit Takes the same specified value as the property for the element's parent.

这篇关于防止跨度元素换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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