<分区>
<分区>
我正在尝试创建一些带有按钮的输入,如下所示:
我阅读了一些教程,这段代码应该可以工作,但我不知道为什么它不起作用。 这是 CSS:
#content input[class="small"] {
font-weight: 400;
color: #909090;
outline: none;
margin-top: 15px;
width: auto;
height: 50px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: solid 2px #e5e5e5;
padding-left: 30px;
}
#content button[type="submit"] {
display: inline-block;
width: 50px;
height: 50px;
padding-right: 10px;
-webkit-border-radius: 0 10px 10px 0;
-moz-border-radius: 0 10px 10px 0;
border-radius: 0 10px 10px 0;
background-color: #23a298;
border: solid 2px #e5e5e5;
}
最佳答案
在您的代码中,col-3>div 的宽度为 33%
。没有适合元素的空间。因此它转到下一行。那是输入框旁边的按钮,不在输入框内。
同时使用媒体查询和宽度以获得更好的输出。
<input type=text><button>Submit</button>
看看这个。无需编写特殊的 CSS 来对齐按钮和输入框。
plunker为您的代码 - 已修复
关于html - 输入 HTML CSS 中的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46043195/