文字与输入一行
我已经分度,输入字段和文本文字与输入一行
这里是代码
.form-control {
display: block;
width: 100%;
height: 34px;
position: relative;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
margin: 0 auto;
background-color: #fff;
border-color: #1f66b4;
border-style: solid;
border-width: 3px;
background-image: none;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
<div style="width:50%;height:100%;float: left;padding-left:20%">
<form style="text-align:center;">
<b>dfsdfsdfsdf</b>
<input type="text" class="form-control" id="lname" name="lname" placeholder="Last Name" style="margin: 30px auto 0;border-radius:50px;border-width: 1px;">
</form>
</div>
但文字是在输入。
我需要的文本一行的输入。 我该怎么做?
希望你已经有的工作正常。运行下面的代码片段查看它。
<div style="width:50%;height:100%;float: left;padding-left:20%">
<form style="text-align:center;">
<b>dfsdfsdfsdf</b>
<input type="text" class="form-control" id="lname" name="lname" placeholder="Last Name" style="margin: 30px auto 0;border-radius:50px;border-width: 1px;">
</form>
</div>
我编辑代码片段 –
裹DIV内部的输入标签。 使用标签标签,而不是说明B标签(它有助于屏幕阅读器) 然后给CSS“浮动:左”为标签和DIV(包装输入)
atlast从您的输入删除保证金和连锁行业一些边距为标签 和浮动后,明确它
<div style="width:50%;height:100%;float: left;padding-left:20%">
<form style="text-align:center;">
<label style="float:left; margin-top:6px">dfsdfsdfsdf</label>
<div style="float:left">
<input type="text" class="form-control" id="lname" name="lname" placeholder="Last Name" style="border-radius:50px;border-width: 1px;">
</div>
<div style="clear:left">
</form>
</div>
我编辑后的帖子 –
好的,我建议使用
标签显示在左上角的页面,而不是div。 –
您可以添加填充的占位符,但浏览器的支持,需要前缀。
::-webkit-input-placeholder { /* Chrome/Opera/Safari */
padding-left: .3em;
}
::-moz-placeholder { /* Firefox 19+ */
padding-left: .3em;
}
:-ms-input-placeholder { /* IE 10+ */
padding-left: .3em;
}
:-moz-placeholder { /* Firefox 18- */
padding-left: .3em;
}
<div style="width:50%;height:100%;float: left;padding-left:20%">
<form style="text-align:center;">
<b>dfsdfsdfsdf</b>
<input type="text" class="form-control" id="lname" name="lname" placeholder="Last Name" style="margin: 30px auto 0;border-radius:50px;border-width: 1px;">
</form>
</div>
<div style="width:50%;height:100%;float: left;padding-left:20%">
<form style="text-align:center;">
<lable> dfsdfsdfsdf</label>
<input type="text" class="form-control" id="lname" name="lname" placeholder="Last Name" style="margin: 30px auto 0;border-radius:50px;border-width: 1px;">
</form>
</div>
我在帖子中编辑过片段 –
flexbox,这花车,表,绝对定位... – domsson
https://codepen.io/anon/pen/RgBxqq似乎在这里很好。我认为我们需要更多地了解你在做什么。 –
你的代码已经工作:https://jsfiddle.net/5kmLszv6/你有关于你的问题的更多信息? – chrona