将文本输入与提交按钮对齐

时间:2019-01-06 03:21:00

标签: css textinput

这将如何完成?

代码: https://jsfiddle.net/6q352ysx/59/

它们的高度相同,但不均匀。

enter image description here

其中哪些会得到:

vertical-align:top;

vertical-align:bottom;

还是只在其中之一上使用它?

那个,或者我会用

vertical-align: middle;

input[type=text] {
  font-size: 22px;
  width: 200px;
  color: #0059dd;
  background: #000000;
  border: 1px solid #0059dd;
}

input[type=submit] {
  font-size: 22px;
  color: #0059dd;
  cursor: pointer;
  height: 31px;
  background: black;
  border: 1px solid #0059dd;
  font-family: "Times New Roman", Times, serif;
}
<div class="info">
  <input id="input" type="text" name="someNameHere" placeholder="someValueHere" />
  <input id="sent" type="submit" value="Set" />
</div>

1 个答案:

答案 0 :(得分:0)

尝试以下CSS:

.info {display:flex}

input[type=text] {
  font-size: 22px;
  width: 200px;
  color: #0059dd;
  background: #000000;
  border: 1px solid #0059dd;
}

input[type=submit] {
  font-size: 22px;
  color: #0059dd;
  cursor: pointer;
  background: black;
  border: 1px solid #0059dd;
  font-family: "Times New Roman", Times, serif;
}

提琴:https://jsfiddle.net/6q352ysx/11/