html - 仅使用 css 更改元素的位置

标签 html css

我有一个网络表单,它的输入包裹在 div 中,看起来像这样

Name
tbFirstName  lblFirstName  tbLastName lblLastName

这是它的 html 标记

<div class="editor-label">
   <label>Name:</label>
</div>

<div class="editor-field">
<span>
    <input id="LastName" name="LastName" type="text" value="" />
    <label for="LastName">Last Name</label>
</span>
<span>
    <input id="FirstName" name="FirstName" type="text" value="" />
    <label for="FirstName">First Name</label>
</span>
</div>

我想知道如何将输出更改为看起来像这样而不是仅使用 css

Name
tbFirstName  tbLastName 
lblFirstName lblLastName  

感谢您的帮助。

最佳答案

.editor-field span {float: left; margin-right: 10px;} // the margin is optional
.editor-field input {display: block;}

关于html - 仅使用 css 更改元素的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4228206/

相关文章:

javascript - 如何使用正则表达式或其他方法从另一个字符串中提取两个 rgb 值/字符串

html - ARIA "role"在html中到底有什么用?

html - 我怎样才能让我的边框底部不覆盖我的 table 边框?

css - Bootstrap 更改 div 顺序,右拉,左拉 3 列

javascript - jquery 增加最后一个

javascript - Jquery 显示隐藏不起作用

css - div列高

html - 调整表格布局 : fixed table in Safari?

javascript - 这个 jQuery "on-mouse-over-scroll-the-image"插件是什么?

jquery - 如何使用 bootstrap 3 隐藏表格中的空单元格