html - 在同一行显示 Div + span?

标签 html css

在同一行显示 div 和 span 时遇到问题..它们的样式..

DIV

 color: black;
 display: inline;
 font-family: arial, sans-serif;
 font-size: 13px;
 height: 0px;
 margin-bottom: 0px;
 margin-left: 0px;
 margin-right: 0px;
 margin-top: 0px;
 overflow-y: visible;
 padding-top: 0px;
 white-space: nowrap;
 width: 0px;

跨度

color: black;
display: inline;
font-family: arial, sans-serif;
font-size: 13px;
height: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
overflow-y: visible;
padding-top: 0px;
width: 0px;

两个都包含在其中的 DIV

color: black;
display: block;
float: left;
font-family: arial, sans-serif;
font-size: 13px;
height: 20px;
margin-bottom: 0px;
margin-left: 8px;
margin-right: 0px;
margin-top: 0px;
overflow-y: visible;
padding-top: 1px;
width: 373px;

要让 div 和 span 显示在同一行上,我需要更改什么?当前显示 div,然后在其下方的行上显示 span。

最佳答案

需要添加display:inline;

关于html - 在同一行显示 Div + span?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5963953/

相关文章:

html - Bootstrap responsive 在调整浏览器大小时效果很好,但在手机中不起作用

html - 溢出隐藏如何影响图像在显着主题中的位置?

html - 如何将网格元素高度设置为其余空间

css - 我的 CSS 代码有什么问题

html - 页脚不在页面底部

javascript - 通过CSS在div中组合文本

php - 变量中的文本将被识别但不会显示

javascript - 我应该怎么做才能避免移动网页上的元素(html、css、jQuery)?

css - 控制换行符使线条宽度相等

html - 在图像链接上获取文本覆盖的问题