我正在尝试将“电子邮件”输入和“提交”按钮放在同一行。这是它的样子:
所以看起来应该是这样的(关于布局):
您可以在此处查看实际页面:http://www.grainbeast.com/free-goods/
你能告诉我怎么做到这一点吗?
答案 0 :(得分:2)
将以下css添加到style.css
#mc4wp-form-1 > input[type="email"] {
display: inline-block;
}
并删除
float: left
来自提交按钮样式,因此html读取
<input type="submit" value="Get Free Access" />
答案 1 :(得分:0)
这是我的解决方案:
https://jsfiddle.net/00adpdb1/
用“overflow:hidden”包裹您的输入,然后用“floar:right”拉到右侧按钮
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
input {display: block;
width: 100%;
height: 36px;
padding: 6px 14px;
font-size: 14px;
line-height: 1.57142857;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #cfd3cc;
border-radius: 2px;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-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;
margin: 0;
}
.btn {
display: block;
padding: 6px 14px;
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
line-height: 1.57142857;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
background-clip: padding-box;
border: 1px solid transparent;
border-radius: 2px;
background:red;
color: #fff;
}
.pull-right {
float:right;
}
.s-margin-left {
margin-left: 10px;
}
<div class="form-group">
<button class="pull-right btn btn-lg btn-primary s-margin-bottom s-margin-left" type="submit">send</button>
<div style="overflow: hidden;">
<input type="email" class="form-control" placeholder="Enter E-mail" value="" id="email" name="email">
</div>
</div>