【发布时间】:2015-08-05 14:58:57
【问题描述】:
我无法在同一行上对齐两个输入框。每当我向右浮动一个时,它会立即将其推到下一行。
如何在同一行有两个输入框,一个在左边,一个在右边对齐,而不被推到下一行?
.inline {
display: inline;
}
input {
width: 15%;
font-weight: bold;
background-color: transparent;
border: 1px solid;
font-size: 13px;
font-family: Arial;
}
html {
height: 100%;
margin-bottom: 0px;
}
* {
margin: 0;
}
.body {
font-family: Arial;
font-size: 13px;
background-color: #ffffff;
margin-top: 0px;
margin-left: 10%;
margin-right: 10%;
margin-bottom: 0px;
padding: 0 height: 100%;
line-height: 200%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto;
/* the bottom margin is the negative value of the footer's height */
}
.footer,
.push {
line-height: 120%;
height: 112px;
/* .push must be the same height as .footer */
text-align: center;
font-size: 10px;
}
<body>
<div class="body">
<div class="wrapper">
<span class="inline">
<input class="inputbold" type="text" name="" placeholder="boldinput" />
<div style="text-align: right;">
<input class="inputbold" type="text" name="" placeholder="blah"/>
</div>
</span>
</div>
</div>
</body>
【问题讨论】:
-
display: inline;在两者上,float: left在一个上,float: right在另一个上,并在两者上设置一些合理的宽度,display: table在容器上,然后在两者上display: table-cell,还有很多的其他方式。你那里一团糟。 -
最后一个 CSS 选择器中的错字
.footer, .push {