html - 输入 HTML CSS 中的按钮

标签 html css button input

<分区>

我正在尝试创建一些带有按钮的输入,如下所示:

enter image description here

我阅读了一些教程,这段代码应该可以工作,但我不知道为什么它不起作用。 这是 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;
}

代码:https://jsfiddle.net/erxsqovh/

最佳答案

在您的代码中,col-3>div 的宽度为 33%。没有适合元素的空间。因此它转到下一行。那是输入框旁边的按钮,不在输入框内。

同时使用媒体查询和宽度以获得更好的输出。

<input type=text><button>Submit</button>

看看这个。无需编写特殊的 CSS 来对齐按钮和输入框。

plunker为您的代码 - 已修复

关于html - 输入 HTML CSS 中的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46043195/

上一篇:JavaFX - 居中覆盖 BorderPane 的 BackgroundImage

下一篇:html - Microsoft Edge 阅读 View 多列 CSS

相关文章:

javascript - Angular 确认框样式

css - 将两张 table 放在一起

html - (提交)按钮标签的样式部分

Javascript event.button 右键单击​​不返回任何值

jquery - 每行内容包裹在一个 div 中

javascript - 按钮上的背景图像增加了边距

kotlin - 点击后传递参数

html - 字段有效时 Angular Material 形式缩小

html - 我怎样才能改变这个页面的颜色?

javascript - 在 Javascript 事件上更改 URL(在 HTML 内)中的变量