下一行可以防止 div 的内容向下移动吗?
我有一个看起来像这样的div:
<div>
That's <div id="output"></div>
</div>
进入第二个div的innerHTML的“输出”是一个单词,这样主div的内容看起来像其中之一,具体取决于用户选择的选择其他地方:
That's right!
That's good.
That's close.
问题是,我的输出 div 没有在同一行输出。所以它看起来像这样
That's
right!
我怎样才能使“输出”的内容始终与主div的其他内容在同一行?
I have a div that looks like this:
<div>
That's <div id="output"></div>
</div>
The "output" that is going into the innerHTML of that 2nd div is a single word, such that the contents of the main div looks like one of these, depending on what choices the user has selected elsewhere:
That's right!
That's good.
That's close.
The problem is, my output div is not outputting on the same line. So it looks like this
That's
right!
How can I make the contents of "output" always be on the same line as the other contents of the main div?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
div 是块元素而不是内联元素。您想使用跨度,所以使用
div is a block element rather than inline. You want to use a span instead so use
Div 是块元素,请使用 span。或者使用 float: left 设置 div 样式
A Div is a block element, use a span instead. Or style your divs with float: left