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

问题描述 投票:0回答:1

怎么做?

代码: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>
css textinput
1个回答
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/

© www.soinside.com 2019 - 2024. All rights reserved.