简体   繁体   English

div标签内的span生成多文本而不是嵌入式文本

[英]span inside div tag produces the multi text instead of inline text

i want to display the text in inline (ie in single line) please refer below code. 我想以内联方式(即单行)显示文本,请参考以下代码。

<DIV id=container_vml_TrackToolTip style="POSITION: absolute; LEFT: 85px; TOP: 58px">
    <SPAN id=container_vml_ToolTipText style="FONT-SIZE: 12px; FONT-FAMILY: Segoe UI; POSITION: absolute; COLOR: yellow; FONT-STYLE: normal; LEFT: 414px; TOP: 126px; VISIBILITY: visible">2009  32</SPAN>
</DIV>

output produce the following result in IE browser. 输出在IE浏览器中产生以下结果。

在此处输入图片说明

i want to display the text inline instead of multi line in a particular position. 我想在特定位置显示文本内联而不是多行。 how can i do this when placing span inside div tag ? 将span放在div标签内时,该怎么办?

Thanks, Siva 谢谢西瓦

试试white-space:nowrap

<DIV id=container_vml_TrackToolTip style="POSITION: absolute;LEFT: 85px; TOP: 58px"><SPAN id=container_vml_ToolTipText style="white-space:nowrap; FONT-SIZE: 12px; FONT-FAMILY: Segoe UI; POSITION: absolute; COLOR: yellow; FONT-STYLE: normal; LEFT: 414px; TOP: 126px; VISIBILITY: visible">2009  32</SPAN></DIV>    

To get the text to display inline you'll want to use a width: 100px in your span. 要使文本以内联方式显示,您需要使用宽度:跨度为100px。 For an example please take a look at this version of the code. 例如,请查看此版本的代码。

<span style="width: 100px; line-height: 20px .....">2009 32</span>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM