Html 同一行上的两个div
为什么这两行“第一个文本”和“第二个文本”不在同一行Html 同一行上的两个div,html,css,Html,Css,为什么这两行“第一个文本”和“第二个文本”不在同一行 <html> <body style="width: 20px;"> <div style="width: auto; display: block; white-space: nowrap;"> <div style="display: inline-block; float: left;">First text</div>
<html>
<body style="width: 20px;">
<div style="width: auto; display: block; white-space: nowrap;">
<div style="display: inline-block; float: left;">First text</div>
<div style="display: inline-block; float: left;">Second text</div>
</div>
</body>
</html>
第一个文本
第二文本
因为您正在浮动元素
移除浮动:左代码>,或使其显示:块代码>
另见:
第一个文本
第二文本
因为您正在浮动元素
移除浮动:左代码>,或使其显示:块代码>
另见:
第一个文本
第二文本
float:left
取消显示:inline
第一个文本
第二文本
float:left
取消显示:inline
第一个文本
第二文本
使用浮点:无
和显示:内联块
使用浮点:无
和显示:内联块